Search Unity

Unable to build for Android -

Discussion in 'Android' started by kathode, Jul 20, 2016.

  1. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    Hi,
    I am trying to get my project going on Android but I'm completely unable to build it. I get the following error when it goes to convert my classes to dex format, and it appears to be erroring out in some Soomla classes.

    CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
    /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/gavin/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/UnityX/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

    stderr[

    PARSE ERROR:
    unsupported class file version 52.0
    ...while parsing com/soomla/rewards/VirtualItemReward.class

    PARSE ERROR:
    unsupported class file version 52.0
    ...while parsing com/soomla/store/billing/google/Consts.class

    PARSE ERROR:
    unsupported class file version 52.0
    ...while parsing com/soomla/AndroidBus.class

    PARSE ERROR:
    unsupported class file version 52.0
    ...while parsing com/soomla/unity/StoreEventHandler.class

    PARSE ERROR:
    unsupported class file version 52.0
    ...while parsing com/soomla/core/unity/SoomlaBridge.class
    5 errors; aborting
    ]​

    I have tried a lot of Googling around but I'm unable to find a solution and I'm completely blocked at the moment. I'm using OSX and have updated Java. The only directory inside my JavaVirtualMachines directory is jdk1.8.0_92.jdk. I cloned Soomla from Github recursively, built all from the OSX terminal, and then ran the deploy commands to generate packages.

    Please help! I am totally blocked and not sure what to do.

    Thank you!
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    From the error message, it seems that some classes (of the Soomla plugin) were compiled using file version 52.0, but are unsupported by the current tools you're using (possibly they are from an older Java version).

    Please make sure you have Java 1.8 installed (JDK) and that you have no other versions (such as 1.6 or 1.7) or at least make sure Unity points to the 1.8 installation.

    BTW: according to the error, it looks like Unity is using JDK1_8, but that tool may be invoking other Java tools that use an older version of Java, not sure really.
     
  3. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    The plugin you are using should be compiled with lower Java level (-source 1.6 -target 1.6) - I think that's the reason.
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @Yury-Habets are you sure this is the issue? The tool that Unity is running (sdktools.jar) - not sure what that is exactly, but it reports a parse error that the class version is not supported (52.0).

    From what i know, 52.0 corresponds to Java 1.8. So, the tool is unable to parse 1.8 classes. Why can't the tool run on a newer Java version, if the developer has JDK 1.8 installed for example ?

    Also, is there a requirement (documented?) regarding plugins that must be compiled wit ha particular Java version ?
     
  5. kathode

    kathode

    Joined:
    Jan 15, 2013
    Posts:
    63
    Hi,
    Thanks for the responses. Just wanted to say that I resolved the issue. The plug-in SOOMLA needed to be compiled with Java 1.7.
    Once that was done, I then had issues that seemed to not be related to SOOMLA. I guess Unity itself needs a higher compiler version. "Unsupported major.minor version 52.0" was the error code.
    I then re-upgraded to JDK 1.8 and I was able to produce an APK file.