- Home /
Having issue with "unable to convert class to dex format" extremely simple JAR in empty project.
I'm having this error: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details. C:\Program Files\Java\jdk1.8.0_40\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/srajabi/AppData/Local/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity5/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar"
To reproduce see this: eclipse project
Or make a java project, reference the unity classes "classes.jar" (Unity version 5.1.1f1) and "android.jar" (version 22, or ICS).
Put in any class.
Make an empty Unity 5.1.1f1 project and put the jar in the plugins folder. Try to build for android and you'll get this issue.
Even simpler. Just make a JAR with JD$$anonymous$$ 1.8, don't include anything, put one empty class in and then put the resulting JAR in the unity project. Still doesn't work.
Figured it out.
See here: http://docs.unity3d.com/$$anonymous$$anual/PluginsForAndroid.html Note: Unity expects Java plugins to be built using JD$$anonymous$$ v1.6. If you are using v1.7, you should include “-source 1.6 -target 1.6” in the command line options to the compiler.