Search Issue Tracker

Fixed in future release

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: 2No workaround

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 (28)

  1. 436fd511d64fe9e162ce3df240b2b57d?d=mm

    Pranay1Knight

    Jul 23, 2018 19:07

    Thank you problem solved, It's working.

  2. B203d401b0d01c03a39935cf2b63f5fd?d=mm

    Thiago-Paiola

    Jul 23, 2018 08:47

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

  3. 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.

  4. B20704082e2f22d251a100c86a622f7d?d=mm

    turgayyuzen

    May 06, 2018 06:10

    thank you

  5. 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

  6. 3477317ecb29910f08d531302e2ca1f0?d=mm

    grrrrrrg69

    Apr 16, 2018 03:52

    ps. Unity 5.3.4f1 (64-bit)

  7. 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...

  8. 06ada52c5cd40ff3b0e9c7ab28734322?d=mm

    Bhanu3D

    Mar 19, 2018 10:46

    Hi Friends,

    The Java version I am using is jdk1.8.0_161. Is this the right one? I am getting Gradle Build Failed : unable to find Build Tools 28.0.0 error. Please help

    Thanks & Regards,
    Bhanu

  9. 47ddb3fda3598eaf5236e69ad62b33c5?d=mm

    Pickles12321

    Mar 03, 2018 19:19

    Same Problem. Even today's android SDK tools update didn't help. Please fix.

All about bugs

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