After over 6 hours of trying solutions, the one Oleg linked me in the comments finally led me to the real cause of the problem.
The brief explanation of the issue can be found HERE, but I will try to explain how everything looked on my system:
This error first showed up for me when I imported a jar file that was part of my main Java project, which was hosted in Eclipse.
The way this error first pokes up to the user is through the Messages tab where Gradle walks through each of its tasks. The task that it crashes on is
:app:transformClassesWithDexForDebug
The problem is the Gradle Messages window just says the task failed and then gives a non-descriptive error message saying
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:Program FilesJavajdk1.7.0_45injava.exe'' finished with non-zero exit value 1
In order to get a better view, you need to go look at the Gradle Console view. The text in the terminal view tells you this:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:Program FilesJavajdk1.7.0_45injava.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Scrolling up a little bit shows that the stacktrace came through just fine, even though this initial message hints that there should be additional flags added for debugging. The top of the stacktrace says this:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
But even that doesn't help very much. What it is trying to tell you (very poorly I have to add) is that the class it is looking at was compiled with a Java version that is not supported. In my case, version (0034) was the hex representation of 52 which means Java 8. Android doesn't support Java 8, so it terminates the build.
The solution was to go back to my Eclipse project and export the jar file with the compiler set to version 1.7 and now everything is up and running again. I hope this helps!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…