简体   繁体   English

使用翻译API后发生错误

[英]Error occurred after using translation api

build.gradle build.gradle

  apply plugin: 'com.android.application'
 android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
    applicationId "com.example.speakplease"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

 dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation ('com.google.apis:google-api-services-translate:v2-rev47- 
1.22.0')
implementation 'com.google.cloud:google-cloud-translate:0.5.0'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.android.support:support-v13:28.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- 
 core:3.0.2'
compileOnly 'com.google.dagger:dagger-parent:2.9'
//noinspection GradleDependency
annotationProcessor 'com.google.auto.value:auto-value:1.2'
}
apply plugin: 'com.google.gms.google-services'

I have imported google translation api and after that I started getting Annotation error. 我已经导入了google translation api,此后我开始出现Annotation错误。 I am able resolve it but not getting this error. 我能够解决它,但没有收到此错误。 I am aware of it that some dependencies are clashing but unable to find out. 我知道有些依赖项存在冲突,但无法查明。

Here is the error. 这是错误。

   Program type already present: 
 com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream
  Message{kind=ERROR, text=Program type already present: 
 com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream, 
  sources=[Unknown source file], tool name=Optional.of(D8)}

This is what happens when your 2 dependencies include the same dependency. 当您的2个依赖项包含相同的依赖项时,就会发生这种情况。 Check out this question to find out how to see which dependency is causing the issue. 查看此问题,以了解如何查看导致此问题的依赖性。

I have had the same problem, for me it was ExoPlayer , cause It was included in a 3rd party library I was using, and I included it by itself also. 我遇到了同样的问题,因为对我来说它是ExoPlayer ,因为它包含在我正在使用的第3方库中,而且我自己也包含了它。

I don't know for sure which 2 are in conflict for you, but these seem suspiciously "related": 我不确定哪两个对您有冲突,但是这些似乎可疑地“相关”:

implementation ('com.google.apis:google-api-services-translate:v2-rev47-1.22.0')
implementation 'com.google.cloud:google-cloud-translate:0.5.0'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM