So… You want to add custom android code to your Unity3D game Android build, right?
The process is generally like this:
- Create an Android library project.
- Write your code.
- Package it in a .jar.
- Copy that .jar to YourUnity3DProject\Assets\Plugins\Android\
- Build Unity3D android build.
Except that for me my .class files were nowhere to be found in the final .apk.
The problem? My .jar was built using JDK7.
It seems that either Unity or DEX cannot handle JDK7 bytecode format. That’s all fine and all, but an error or at least a warning would be nice…
Solution: be sure to use JDK6 when you package your code to the .jar.