When I run InstrumentationTest,It's build failed.The error message:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebugAndroidTest'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/test/InstrumentationRegistry.class
Somebody tell me why?thank you for you notice
It's just miss words in build.gradle :
packagingOptions {
exclude 'LICENSE.txt'
}
But when I add those words,build failed too,and report other error message :
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/test/BuildConfig;
Error:Execution failed for task ':app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2
Related
I am getting this error when I'm going to build apk.
Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 3
Here's the screenshot of the error
My problem is solved by using multidex. By adding multiDexEnabled true in defaultConfig and compile 'com.android.support:multidex:1.0.0'
in dependencies in build gradle in app and adding android:name="android.support.multidex.MultiDexApplication" in manifest. Check out screen shots 2:
1:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_92\bin\java.exe'' finished with non-zero exit value 2
If your using Android Studio 2.1.2 and buildtoolVersion as 24.0.0. Downgrade it to 23.0.X.
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_75\bin\java.exe'' finished with non-zero exit value 2`
i got error when use this lib
compile 'com.github.jd-alexander:library:1.1.0'
what does that mean?
I installed retrofit2 in Android Project using following gradle lines;
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
In the first attempt, the following error is occurred.
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
After that, I added following line under defaultConfig
multiDexEnabled true
As a result of this, the following error is occured.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/gson/annotations/Expose.class
Finally, I tried this (Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug') solution, but the result is same.
How can I solve this problem?
I found the solution. If you exclude the gson module from converter-gson, It works.
Like this;
dependencies {
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile ('com.squareup.retrofit2:converter-gson:2.0.0-beta4'){
exclude module: 'gson'
}
}
here is my full code, when I run following code with "Run/Debug configurations > Android Tests"
class KernelTest extends Specification {
def "match"() {
given:
println("smth");
}
}
I get error:
Execution failed for task ':app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/jdk8/bin/java'' finished with non-zero exit value 3
here is full output
how to fix it?
update
I have check the question, but I don't know which jar is duplicated
See the full output, the reason is about groovy, I remove all groovy dependencies and work well