Unity3D is ommiting your .class files from Android plugin?

Hi there.

So… You want to add custom android code to your Unity3D game Android build, right?

The process is generally like this:

  1. Create an Android library project.
  2. Write your code.
  3. Package it in a .jar.
  4. Copy that .jar to YourUnity3DProject\Assets\Plugins\Android\
  5. 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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s