我正在尝试在我的应用程序中实现语言翻译功能,因此要实现此功能,我正在使用 Gradle 依赖项: “com.google.cloud:google-cloud-translate:0.5.0”同步依赖项后,我收到以下警告:
同步后
信息:Gradle 任务 [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
警告:警告:依赖 org.apache.httpcomponents:httpclient:4.0.1 被忽略以进行调试,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.json:json:20151123 被忽略以进行调试,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.apache.httpcomponents:httpclient:4.0.1 被忽略以进行调试,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.json:json:20151123 被忽略以进行调试,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.apache.httpcomponents:httpclient:4.0.1 在发布时会被忽略,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.json:json:20151123 被忽略发布,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.apache.httpcomponents:httpclient:4.0.1 在发布时会被忽略,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.json:json:20151123 被忽略发布,因为它可能与 Android 提供的内部版本冲突。
信息:构建成功
信息:总时间:4.54秒
信息:0 错误
信息:8 个警告
信息:在控制台中查看完整的输出
当我在同步后运行项目时,出现以下错误:
重复条目:com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class
运行我的项目后出现错误
信息:Gradle 任务 [:app:assembleDebug]
警告:警告:依赖 org.apache.httpcomponents:httpclient:4.0.1 被忽略以进行调试,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.json:json:20151123 被忽略以进行调试,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.apache.httpcomponents:httpclient:4.0.1 被忽略以进行调试,因为它可能与提供的内部版本冲突
安卓。
警告:警告:依赖 org.json:json:20151123 被忽略以进行调试,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.apache.httpcomponents:httpclient:4.0.1 在发布时会被忽略,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.json:json:20151123 被忽略发布,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.apache.httpcomponents:httpclient:4.0.1 在发布时会被忽略,因为它可能与 Android 提供的内部版本冲突。
警告:警告:依赖 org.json:json:20151123 被忽略发布,因为它可能与 Android 提供的内部版本冲突。
警告:AndroidManifest.xml 已定义可调试(在 http://schemas.android.com/apk/res/android 中);使用 list 中的现有值。
错误:任务“:app:transformClassesWithJarMergingForDebug”执行失败。
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class
信息:构建失败
信息:总时间:38.0秒
信息:1个错误
信息:9 个警告
信息:在控制台中查看完整的输出
最佳答案
finally.... i solved it by doing this
1. changing the google play services dependency version from 9.8.0 to 9.6.0.
2.forcing google play services to install in "resolutionStrategy" section
ie: `configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services:9.6.0'
}
}`
note these are the main changes i did in my gradle:
compile ('com.google.cloud:google-cloud-translate:0.5.0') {
exclude group: 'io.grpc', module: 'grpc-all'
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.api-client', module: 'google-api-client-appengine'
}
and configurations to force dependencies to override some common classes
configurations.all {
exclude group: "org.apache.httpcomponents", module: "httpclient"
exclude group: 'org.json', module: 'json'
resolutionStrategy {
force 'com.google.code.findbugs:jsr305:1.3.9'
force 'com.android.support:design:23.4.0'
force 'com.android.support:support-v4:23.4.0'
force 'com.android.support:appcompat-v7:23.4.0'
force 'com.google.android.gms:play-services:9.6.0'
}
}
关于android - Google Translate API 出错(错误 :Execution failed for task ':app:transformClassesWithJarMergingForDebug, 重复条目),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40379169/