Search Issue Tracker

Fixed in 2018.3.X

Fixed in 2017.4.X, 2018.2.X

Votes

80

Found in

Issue ID

956425

Regression

No

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

Android

-

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

  1. 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 (88)

  1. unity_K99WJS2TxGpRtA

    Jul 02, 2020 06:27

    I am glad you take pride in what you write. This makes you stand way out from many other writers that push poorly written content.
    go to the website https://images.google.tm/url?q=https://federicogavazzi.com/

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

    Jul 23, 2018 19:07

    Thank you problem solved, It's working.

  4. Thiago-Paiola

    Jul 23, 2018 08:47

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

  5. turgayyuzen

    May 06, 2018 06:10

    thank you

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

  7. grrrrrrg69

    Apr 16, 2018 03:52

    ps. Unity 5.3.4f1 (64-bit)

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

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

  10. Pickles12321

    Mar 03, 2018 19:19

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

Add comment

Log in to post comment

All about bugs

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