在Android Studio中尝试使用已签名的APK的gradle版本构建时,我遇到了这些令人沮丧的错误。 7个错误之一是错误:未捕获的翻译错误:java.lang.IllegalArgumentException:已添加:Lcom / google / android / gms / internal / zzbz;
这是gradle控制台输出:
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2501Library
:app:prepareComAndroidSupportAppcompatV72501Library
:app:prepareComAndroidSupportCardviewV72500Library
:app:prepareComAndroidSupportCustomtabs2500Library
:app:prepareComAndroidSupportDesign2501Library
:app:prepareComAndroidSupportMultidex101Library
:app:prepareComAndroidSupportRecyclerviewV72501Library
:app:prepareComAndroidSupportSupportCompat2501Library
:app:prepareComAndroidSupportSupportCoreUi2501Library
:app:prepareComAndroidSupportSupportCoreUtils2501Library
:app:prepareComAndroidSupportSupportFragment2501Library
:app:prepareComAndroidSupportSupportMediaCompat2501Library
:app:prepareComAndroidSupportSupportV132501Library
:app:prepareComAndroidSupportSupportV42501Library
:app:prepareComAndroidSupportSupportVectorDrawable2501Library
:app:prepareComAndroidSupportTestTestingSupportLib01Library
:app:prepareComAndroidSupportTestUiautomatorUiautomatorV18212Library
:app:prepareComAndroidSupportTransition2501Library
:app:prepareComAndroidVolleyVolley100Library
:app:prepareComFacebookAndroidAccountKitSdk4180Library
:app:prepareComFacebookAndroidAudienceNetworkSdk4180Library
:app:prepareComFacebookAndroidFacebookAndroidSdk4180Library
:app:prepareComGithubCoyarzun89Fabtransitionactivity020Library
:app:prepareComGithubOzodrukhCircularReveal131Library
:app:prepareComGoogleAndroidExoplayerExoplayerR158Library
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics1001Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl1001Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth1001Library
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase1001Library
:app:prepareComGoogleAndroidGmsPlayServicesBase1001Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement1001Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation1001Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps1001Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus1001Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerV4Impl1001Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks1001Library
:app:prepareComGoogleFirebaseFirebaseAnalytics1001Library
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl1001Library
:app:prepareComGoogleFirebaseFirebaseAppindexing1001Library
:app:prepareComGoogleFirebaseFirebaseCommon1001Library
:app:prepareComGoogleFirebaseFirebaseCore1001Library
:app:prepareComGoogleFirebaseFirebaseIid1001Library
:app:prepareComGoogleMapsAndroidAndroidMapsUtils04Library
:app:prepareNetSteamcraftedLoadToast1010Library
:app:prepareNetYslibraryKeyboardvisibilityeventKeyboardvisibilityevent101Library
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:processReleaseGoogleServices
Parsing json file: C:\Users\antho\AndroidStudioProjects\suRRo\app\google-services.json
:app:generateReleaseResources
:app:mergeReleaseResources UP-TO-DATE
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseResources UP-TO-DATE
:app:generateReleaseSources UP-TO-DATE
:app:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:app:javaPreCompileRelease
:app:compileReleaseJavaWithJavac UP-TO-DATE
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources UP-TO-DATE
:app:mergeReleaseShaders UP-TO-DATE
:app:compileReleaseShaders UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:transformClassesWithDexForRelease
Running dex as a separate process.
To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 4608 MB (based on the dexOptions.javaMaxHeapSize = 4g).
To do this set org.gradle.jvmargs=-Xmx4608M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzbz;","sources":[{}]}
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzai;","sources":[{}]}
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzai$zza;","sources":[{}]}
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzai$zzb;","sources":[{}]}
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzai$zzc;","sources":[{}]}
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzai$zzd;","sources":[{}]}
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzai$zze;","sources":[{}]}
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzai$zzf;","sources":[{}]}
AGPBI: {"kind":"error","text":"Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzai$zzg;","sources":[{}]}
AGPBI: {"kind":"error","text":"Error converting bytecode to dex:\nCause: java.lang.RuntimeException: Translation has been interrupted","sources":[{}],"original":"UNEXPECTED TOP-LEVEL EXCEPTION:\njava.lang.RuntimeException: Translation has been interrupted\n\tat com.android.dx.command.dexer.Main.processAllFiles(Main.java:613)\n\tat com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)\n\tat com.android.dx.command.dexer.Main.run(Main.java:275)\n\tat com.android.dx.command.dexer.Main.main(Main.java:245)\n\tat com.android.dx.command.Main.main(Main.java:106)\nCaused by: java.lang.InterruptedException: Too many errors\n\tat com.android.dx.command.dexer.Main.processAllFiles(Main.java:605)\n\t... 4 more\n","tool":"Dex"}
:app:transformClassesWithDexForRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --force-jumbo --num-threads=4 --multi-dex --output C:\Users\antho\AndroidStudioProjects\suRRo\app\build\intermediates\transforms\dex\release\folders\1000\1f\main C:\Users\antho\.android\build-cache\2d0b91b1c1c87808b2e3340e90ac83a720b15f50\output\jars\classes.jar C:\Users\antho\.android\build-cache\a7a058614312b7a634e1cbc699ed60d0ef57f501\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.5\e7fd981408caba8a0c0fb276413562468d260160\log4j-api-2.5.jar C:\Users\antho\.android\build-cache\aaf405a541520b4e4077fdefe0fcb1c796c17608\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.4.0\d6a66c7a5f01cf500377bd669507a08cfeba882a\jackson-annotations-2.4.0.jar C:\Users\antho\.android\build-cache\ac1e5c369d56f1b4ec7890c48bac586070d34243\output\jars\classes.jar C:\Users\antho\.android\build-cache\c174b3d25e69025e44814ef345573464589ffd2d\output\jars\classes.jar C:\Users\antho\.android\build-cache\b763cf772457e939e914c0794d87762d4c7f0fcd\output\jars\classes.jar C:\Users\antho\.android\build-cache\7b0bb18190c5d4348456cc5833551352204457c7\output\jars\classes.jar C:\Users\antho\.android\build-cache\65dc799efbb181f4617e9dc488b1bc2d844bd446\output\jars\classes.jar C:\Users\antho\.android\build-cache\131c5523d1c6a055766b00aedc2581c6a3a8e49f\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.4.2\ceb72830d95c512b4b300a38f29febc85bdf6e4b\jackson-core-2.4.2.jar C:\Users\antho\AndroidStudioProjects\suRRo\app\libs\httpclient-4.5.1.jar C:\Users\antho\.android\build-cache\18c93fb35c04381f761571b82bc4a31ca5c1e905\output\jars\classes.jar C:\Users\antho\AppData\Local\Android\Sdk\extras\android\m2repository\com\android\support\support-annotations\25.0.1\support-annotations-25.0.1.jar C:\Users\antho\.android\build-cache\afe31b5f75506c2e56edcdf521edecfe36d32b72\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-core\1.1\860340562250678d1a344907ac75754e259cdb14\hamcrest-core-1.1.jar C:\Users\antho\.android\build-cache\27a595fcfbc73f29f29b1fb461cc5f86f5318c8c\output\jars\classes.jar C:\Users\antho\.android\build-cache\99ce96694731ff47b104f2e290f67fe10ce90c54\output\jars\classes.jar C:\Users\antho\.android\build-cache\fdd1d0c87a40cf863e704483c0ef58a4ff029324\output\jars\libs\internal_impl-25.0.1.jar C:\Users\antho\.android\build-cache\74fd0bcdbd9ce8252c8b8ff0fef5999144799f9e\output\jars\classes.jar C:\Users\antho\.android\build-cache\42c36cf9c2f6d278402c8540ff48575a20db3fb3\output\jars\classes.jar C:\Users\antho\.android\build-cache\67fa7bfce85d308be6fc4b9ba769bfd8c677694f\output\jars\libs\internal_impl-25.0.1.jar C:\Users\antho\.android\build-cache\d5dcb7f8701d53bdda06c0468a25b4b0f3218ba9\output\jars\classes.jar C:\Users\antho\.android\build-cache\2258f8b1fc724b8596ba44ccce89a6344d994c23\output\jars\libs\internal_impl-25.0.1.jar C:\Users\antho\.android\build-cache\fe966e9f5777e76d91fdf25e6ddb8fa5abca49f0\output\jars\classes.jar C:\Users\antho\.android\build-cache\3fd480b6609ab4b64ad5e40e4c3c580c0cfe5b28\output\jars\classes.jar C:\Users\antho\.android\build-cache\aa969ef2a2206302c350fc9da25b4973fcb78e34\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\com.parse.bolts\bolts-tasks\1.4.0\d85884acf6810a3bbbecb587f239005cbc846dc4\bolts-tasks-1.4.0.jar C:\Users\antho\.android\build-cache\fe966e9f5777e76d91fdf25e6ddb8fa5abca49f0\output\jars\libs\internal_impl-25.0.1.jar C:\Users\antho\.android\build-cache\8cac689fa47637e234d097fb344a648a8a4e8eac\output\jars\classes.jar C:\Users\antho\.android\build-cache\95134680f666232e9b56425037167f9940c5579c\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\com.google.code.gson\gson\2.4\695b63d702f505b9b916e02272e3b6381bade7f\gson-2.4.jar C:\Users\antho\.android\build-cache\c9d985492464b4d6f493c3299fe3cfcd53c9814c\output\jars\classes.jar C:\Users\antho\.android\build-cache\2d0b91b1c1c87808b2e3340e90ac83a720b15f50\output\jars\libs\internal_impl-25.0.1.jar C:\Users\antho\.android\build-cache\fdd1d0c87a40cf863e704483c0ef58a4ff029324\output\jars\classes.jar C:\Users\antho\.android\build-cache\67fa7bfce85d308be6fc4b9ba769bfd8c677694f\output\jars\classes.jar C:\Users\antho\.android\build-cache\8b395f0464ca19c82b8b12a95c601918c8ededc6\output\jars\classes.jar C:\Users\antho\.android\build-cache\f6c8c1a1e59d4c435d1849d2bd756adbc0e948ce\output\jars\classes.jar C:\Users\antho\.android\build-cache\af273acbd78dfb7869cd92938b5f0f64aed37737\output\jars\classes.jar C:\Users\antho\AndroidStudioProjects\suRRo\app\libs\common-lang3.jar C:\Users\antho\.android\build-cache\a279b16f426a47a725cb11ebbb9f91e21324970a\output\jars\classes.jar C:\Users\antho\.android\build-cache\4044de0f4e99590b27abe31e592799a6f6b22909\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\com.parse.bolts\bolts-applinks\1.4.0\8ad21bf21784dacce5f2043afb97218cc377e835\bolts-applinks-1.4.0.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\junit\junit-dep\4.10\64417b3bafdecd366afa514bd5beeae6c1f85ece\junit-dep-4.10.jar C:\Users\antho\.android\build-cache\a6a746c76b80fb188a449e9dc90808d61464d15a\output\jars\classes.jar C:\Users\antho\.android\build-cache\dcedf40f0b285b2c5a5bf8d72b971dd3281f2058\output\jars\classes.jar C:\Users\antho\.android\build-cache\41f0bed0c279cdfbeddddfd188f9da5fa63d32aa\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.4.2\8e31266a272ad25ac4c089734d93e8d811652c1f\jackson-databind-2.4.2.jar C:\Users\antho\.android\build-cache\9e62638a47b2a6ad55f57536070e28935f57d98e\output\jars\classes.jar C:\Users\antho\.android\build-cache\b087012239c40414676ceea614da7db4cee81385\output\jars\classes.jar C:\Users\antho\.android\build-cache\0e8bce1e98224e469a4886ca72d8386891ef45cd\output\jars\classes.jar C:\Users\antho\AndroidStudioProjects\suRRo\app\build\intermediates\classes\release C:\Users\antho\.android\build-cache\4c0fe81be18463201973d15abb1c132c9abf7150\output\jars\classes.jar C:\Users\antho\AndroidStudioProjects\suRRo\app\libs\httpcore-4.4.3.jar C:\Users\antho\.android\build-cache\2f9d494d73626bc874dd2faf38cfd1b1219a3755\output\jars\classes.jar C:\Users\antho\.android\build-cache\47b157cd79531994adab5447efea8041ed038aee\output\jars\classes.jar C:\Users\antho\.android\build-cache\8a6b9a62ff5b629bae4798656cea706b3f90a0bf\output\jars\classes.jar C:\Users\antho\.android\build-cache\c9d985492464b4d6f493c3299fe3cfcd53c9814c\output\jars\libs\internal_impl-25.0.1.jar C:\Users\antho\.android\build-cache\9bff2a736b283147fd0c814e123bcf0f224ab162\output\jars\classes.jar C:\Users\antho\AndroidStudioProjects\suRRo\app\libs\rabbitmq-client.jar C:\Users\antho\.android\build-cache\2258f8b1fc724b8596ba44ccce89a6344d994c23\output\jars\classes.jar C:\Users\antho\.android\build-cache\ee47fdf395ed82d328d79020b5ca98da7f61abd5\output\jars\classes.jar C:\Users\antho\.gradle\caches\modules-2\files-2.1\com.nineoldandroids\library\2.4.0\e9b63380f3a242dbdbf103a2355ad7e43bad17cb\library-2.4.0.jar C:\Users\antho\.android\build-cache\f2b28e73da25dbc4a49a01a3e145300917435d27\output\jars\classes.jar C:\Users\antho\.android\build-cache\e1ddaa2ecd6104c4ac36217a4681b182fe69ab20\output\jars\classes.jar C:\Users\antho\.android\build-cache\890602f5504b8a1586620d80ada235b0686b86a8\output\jars\classes.jar}
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 17.147 secs
这是我的应用程序的Gradle文件:
apply plugin: 'com.android.application'
configurations {
all*.exclude group: 'com.google.android.gms', module: 'play-services'
}
android {
dexOptions {
javaMaxHeapSize "4g"
jumboMode = true
preDexLibraries = false
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
signingConfigs {
debug {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('C:/Users/antho/.android/debug.keystore')
storePassword 'android'
}
release {
keyAlias ''
keyPassword ''
storeFile file('')
storePassword ''
}
}
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.mobilereign.suRRoLive"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0.1"
multiDexEnabled = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
renderscriptDebuggable false
}
debug {
minifyEnabled false
debuggable true
jniDebuggable true
signingConfig signingConfigs.debug
renderscriptDebuggable true
zipAlignEnabled false
}
}
packagingOptions {
exclude 'libs/gson-1.7.1.jar'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/MANIFEST.MF'
}
productFlavors {
}
}
repositories {
flatDir {
dirs 'libs'
}
repositories {
mavenCentral()
}
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:support-v13:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services-analytics:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-plus:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:multidex:1.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/common-lang3.jar')
compile files('libs/httpcore-4.4.3.jar')
compile files('libs/httpclient-4.5.1.jar')
compile 'org.apache.logging.log4j:log4j-api:2.5'
compile files('libs/rabbitmq-client.jar')
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.facebook.android:audience-network-sdk:4.+'
compile 'com.facebook.android:account-kit-sdk:4.+'
compile 'com.fasterxml.jackson.core:jackson-core:2.4.2'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
compile 'net.steamcrafted:load-toast:1.0.10'
compile 'com.github.coyarzun89:fabtransitionactivity:0.2.0'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.1'
compile 'com.android.support.test:testing-support-lib:0.1'
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}
apply plugin: 'com.google.gms.google-services'
Here is my Gradle File for the Project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
基本上我想知道是否有人可以告诉我我需要从特定的依赖项或依赖项中排除它以使其工作。我浪费了2天。我非常沮丧,非常感谢任何帮助。
答案 0 :(得分:0)
对于错误"已添加:..." :看起来你有两次相同的依赖/ jar。
使用命令行检查:
gradlew -q dependencies app:dependencies --configuration compile
然后排除两次包含的模块。
答案 1 :(得分:-1)
我猜你的gradle堆太小了 首先:
dexOptions {
javaMaxHeapSize "4g"
jumboMode = true
preDexLibraries = false
}
已弃用
其次: 并添加
org.gradle.configureondemand=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4608M
在根项目gradle.properties
中第三: 同步gradle