Search Issue Tracker

Active

Votes

44

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

Comments (15)

  1. Bc9003da95d3e45aa9b9d7b941102b19?d=mm

    alexan146

    Jan 15, 2018 17:42

    Same problem, same error message, it's not possible to create a build. I have only managed to solve this by downgrading JDK to 8u151 and also the android SDK (r25.2.5 - replacing "tools" folder). I would be really grateful if the developers could fix this, it's been a pain in the ass for a long time.

  2. 1932242bdd892819ef21d87693f149e9?d=mm

    XraZerTR

    Jan 14, 2018 15:51

    My unity can't find the newest sdk folder. Fix please.

  3. 6ca45dd46b5c60e1f83f900fdb010206?d=mm

    rpra

    Jan 10, 2018 17:49

    Cbarnes_Bnea, Thank you so much for pointing this. Had already set the path to JDK8, but never thought that just having JDK9 will cause the error! Deleting JDK9 from the JavaVirtualMachines folder solves it!

  4. 2093c89f135a046310d51ea832e34991?d=mm

    EdwinSly

    Jan 05, 2018 02:53

    Hello, in this video i explain how to resolve this problem https://youtu.be/UaQe-fnsM4w

  5. 3cf8443762d6a25963b580ceaffbb0f0?d=mm

    praktech

    Dec 29, 2017 01:38

    Thank @NOUMANNOOR987
    Its help to sort out my same problem.
    I currently have latest sdk with jdk 8 on unity 2017.3
    and now working .

  6. 58bbee5441c8e58d4211c56e7f204f14?d=mm

    QI

    Dec 11, 2017 07:09

    Same problem.
    Please fix.

  7. D110b8d4ab97eb154e59267fd113599d?d=mm

    soranhanmul

    Dec 11, 2017 06:08

    5.6.3p1 didn't work too

  8. 42488fb398144043ffe8e1f5913eec92?d=mm

    BergMarques

    Dec 09, 2017 20:54

    I tried almost all ways that I found here and anothers threads. But, unfortunately, nothing is working. So sad! :(

  9. 6e891fffcd6b651fca09f7939b5ee4c6?d=mm

    PictonicStudio

    Nov 18, 2017 07:59

    This has been going on since Android was a thing, with hacky ways of getting it to work. I don't think it's ever going to get fixed lol.

  10. 23f30b318eb233c7706d6d9afebc781d?d=mm

    noumannoor987

    Nov 07, 2017 22:01

    If you are using JDK 9 and trying to build for Android in Unity - you're most likely to have your build failed, with message like "Unable to list target platforms" - "Error:Invalid command android".

    We are working together with Google on fixing this issue - it requires fixes on Unity side, but also Android SDK tools need to be updated to be compatible with latest Java.

    In the meanwhile, we recommend using Java 8 (JDK 8). You can have both Java installations side-by-side, just need to configure Unity Preferences => External Tools => JDK to point to your JDK 8 installation.

    We apologize for the inconvenience caused!
    Your Unity Mobile team

All about bugs

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