Search Unity

Trouble setting up Android build env in Unity

Discussion in 'Android' started by coshea, Jun 22, 2020.

  1. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    319
    Hi, I'm trying to build my Unity 2017.4.40 project for Android on macOS and I get this error:

    The documentation for this version of Unity says "Unity requires the 64-bit version JDK 8 (1.8)"
    https://docs.unity3d.com/2017.4/Documentation/Manual/android-sdksetup.html

    I installed the Oracle package from the documentation link, the External Tools (for JDK) in Unity Preferences says:
    /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/

    Using this tutorial to check what java is running on this (new) machine, it just comes back with

    Matching Java Virtual Machines (1):
    1.8.0_251, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

    Is the issue here, or with Android Studio & Android SDK?

    Many thanks
    Chris
     
    Deleted User likes this.
  2. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    319
    ApkSignerTool has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0

    So ApkSignerTool is built with Java 9 and my Mac uses Java 8?
     

    Attached Files:

  3. Deleted User

    Deleted User

    Guest

    I have the exact same error here with Unity 2019.4.16f1.

    Have you figured it out by any chance?
     
  4. Deleted User

    Deleted User

    Guest

    This post solved my problem. I uninstalled my game from the phone and then new installations succeeded.
     
  5. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    319
    I've still no luck in solving this. The first post was based on my using Android SDK 30 (with build tools) via Android Studio. I tried installing SDK 28 with build tools, but same issue. I can see folders in build-tools, 28 and 30. Both have apksigner in them.

    How can I make Unity use SDK 28 instead of 30?

    The example on the Unity page says to set the unity preference like this example in the external tools
    c:\<android tools install location>\platforms\android–27

    However I can't select the platform sub folders, it wants the Android SDK root folder.

    My external tools settings for Android look like this:

    SDK = /Users/[name]/Library/Android/sdk
    JDK = /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/
    NDK = /Users/[name]/Android/android-ndk-r13b

    Tearing my hair out as I don't know enough about the inner workings of Java and how building for Android works, I just follow what Unity tells me on the help page and it normally works.

    Thanks