Search Issue Tracker

Fixed in Unity 2018.3

Votes

80

Found in

Issue ID

956425

Regression

No

Android builds fail with Java 9 JDK and Unable to list target platforms error

Android

-

-

Priority: 2Necessary for shipping a final release

-

Severity: 2Core functionality majorly impacted

With the latest public versions of Unity (2017.1.1f1), Android Studio/SDK tools(26.0.2), and JDK (Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode), Android builds failed early on with:

Error:Invalid command android
CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
See the Console for more details. Error building Player: CommandInvokationFailure: Unable to list
target platforms. Please make sure the android sdk path is correct. See the Console for more details.

A similar problem (same error message, but different cause) has been reported about 6 months ago: https://issuetracker.unity3d.com/issues/android-build-fails-when-the-latest-android-sdk-tools-25-dot-3-1-version-is-used

In my case, downgrading to JDK 8 fixed the problem.

Reproduced with:
2017.3.0b4, 2017.2.0f3, 2017.1.2f1, 5.6.3p4, 5.5.5f1

Response avatar

Yury-Habets

May 18, 2018

Unfortunately there are compatibility issues between JDK9 and JDK10 and Android SDK.
The bugs have been reported to Google, we are working on a full-featured fix.
As a workaround, for now please UNINSTALL JDK9/10 and INSTALL only JDK8 (64-bit).
We apologize for the inconvenience caused.

Feel free to check the status at the forums as well: https://forum.unity.com/threads/java-9-jdk-9-support-by-unity-android.499354/

Comments (30)

  1. Bde1a4d11bd1a8ef2835ede7866c5436?d=mm

    renyuzhuo

    Sep 28, 2018 08:34

    export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
    open -n /Applications/Unity/Unity.app

    From: https://github.com/RWebRTC/Blog/issues/37

  2. Aaf8805b48065e2001fae0e2f5a92a98?d=mm

    Ricachet

    Sep 13, 2018 14:21

    As of 9/12 Unity will tell you to download JDK 8 if you try to use 10. Thanks for this warning :)

  3. 436fd511d64fe9e162ce3df240b2b57d?d=mm

    Pranay1Knight

    Jul 23, 2018 19:07

    Thank you problem solved, It's working.

  4. B203d401b0d01c03a39935cf2b63f5fd?d=mm

    Thiago-Paiola

    Jul 23, 2018 08:47

    My solution was uninstalling Java 10 and reinstalling Java 8 on Windows 10.

  5. Ac8ffc316a0ea86a057fd6263926cd03?d=mm

    love_for_world

    Jun 26, 2018 09:50

    in my case this version is working good jre1.8.0_172.
    here is link to download
    http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

    COMMENT from Yury Habets: Unity requires JDK and not JRE. Please don't promote this solution, it may have worked because of coincidence.

  6. B20704082e2f22d251a100c86a622f7d?d=mm

    turgayyuzen

    May 06, 2018 06:10

    thank you

  7. 929b582ceb4921ea732c3e4bef3e9f98?d=mm

    jl008

    Apr 23, 2018 13:36

    Unity version: 2017.4.1f1
    JDK version: 10.0.1

    Error:
    Failed to compile resources with the following parameters:
    -bootclasspath "C:/apps/android-sdk\platforms\android-27\android.jar" -d "C:\temp\DemoAppUnity_6.7.8\DemoApp\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\Company\ProductName\R.java" "com\vj\isdemo\R.java" "com\vj\isdemo\resources\R.java"
    warning: [options] source value 6 is obsolete and will be removed in a future release
    warning: [options] target value 1.6 is obsolete and will be removed in a future release
    warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    3 warnings

  8. 3477317ecb29910f08d531302e2ca1f0?d=mm

    grrrrrrg69

    Apr 16, 2018 03:52

    ps. Unity 5.3.4f1 (64-bit)

  9. 999671153d8b9b3d9cb4502d21ae4667?d=mm

    Zuicis

    Apr 12, 2018 13:49

    OS WIN10
    Android sdk build tools - latest by unity target (27) (installed versions on android studio: 26.0.0 - 28.0.0-rc1)
    Unity version: 2017.4.1f1

    Java: jdk1.8.0_144 - works
    Java: jdk1.8.0_151 - works
    Java: jdk1.8.0_162 - works

    Java: jdk-9.0.4 - failed to compile resources...
    Java: jdk-10 - failed to compile resources...

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.