Reputation: 742
I've been unable to build my project due to this error:
Error:Gradle: Execution failed for task ':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_74\bin\java.exe'' finished with non-zero exit value 1
The build used to work, no new dependencies were added, nor Java updates nor Gradle updates, it stopped working all of a sudden. My method count doesn't surpass 2^16 methods (counted per http://www.methodscount.com).
Have tried various solutions proposed in StackOverflow (except multiDex which I don't want to use), but to no effect, including:
preDexLibraries = false
My projects uses the following external libraries:
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'net.sourceforge.jexcelapi:jxl:2.6.12'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'joda-time:joda-time:2.9.2'
compile 'org.achartengine:achartengine:1.2.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
testCompile 'org.jmockit:jmockit:1.22'
testCompile 'junit:junit:4.12'
Built the project with the command line gradlew build --stacktrace --info
. This is the relevant part:
Starting process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe''. Working directory: C:\Users\<MyUser>\Documents\<MyProjects>\<MyApp> Command: C:\Program Files\Java\jdk1.8.0_74\bin\java.exe -Djava.awt.headless=true -Xmx4g -Dfile.encoding=UTF-8 -Duser.country=<CountryCode> -Duser.language=<LanguageCode> -Duser.variant -cp C:\Users\<MyUser>\AppData\Local\Android\android-sdk\build-tools\23.0.2\lib\dx.jar com.android.dx.command.Main --dex --verbose --num-threads=4 --output C:\Users\<MyUser>\Documents\<MyProjects>\<MyApp>\build\intermediates\pre-dexed\debug\com.google.android.gms-play-services-base-8.4.0_f1b0dcf4430103fbfcfd5d1164213cb1cfdd3142.jar C:\Users\<MyUser>\Documents\<MyProjects>\<MyApp>\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\8.4.0\jars\classes.jar
Successfully started process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe''
processing <FilesInMyProject>.class...
:transformClassesWithDexForDebug FAILED
:transformClassesWithDexForDebug (Thread[Task worker Thread 3,5,main]) completed. Took 34.893 secs.
If I run the command listed above (Command: C:\Program Files\Java\jdk1.8.0_74\bin\java.exe -Djava.awt.headless=true [...]
), it runs perfectly fine.
I am not sure what additional information is needed to solve this issue. I'll post more information as requested.
Regards.
Upvotes: 1
Views: 831
Reputation: 742
The problem was an old file which I had emptied while doing a refactor and had a package header as package java;
This caused the error. While looking at the info shown in console it stated that it had trouble processing the class XXXX and "Ill-advised or mistaken usage of a core class (java.* or javax.*) [...]"
Upvotes: 1