Unity 5.6.4p3 build Android App Unable to list target platforms.
Hello, i get the "Unable to list target platforms" error when try to build my test Game for Android. The full Error:
Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Users/user1/Library/Android/sdk/tools/bin/avdmanager list target -c
stderr[
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
]
stdout[
]
exit code: 1
I set the External build tools of unity3d already like below:
SDK: /Users/user1/Library/Android/sdk
JDK: /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
NDK: /Users/svenkohagen/Library/Android/android-ndk-r18
When I set the following java version in my console:
java -version
java version "1.8.0_144"
I can execute the command: /Users/user1/Library/Android/sdk/tools/bin/avdmanager list target -c
and get the following output:
android-24==============================] 100% Fetch remote repository...
android-25
android-26
android-27
android-28
when I switch to java version java version "11" 2018-09-25
I get the following error like in Unity:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
Even when I set the JDK Path in unity to /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
the build does not work even if can execute the /Users/user1/Library/Android/sdk/tools/bin/avdmanager list target -c
command in my console. I use macOS Version 10.13.6.
Anyone an idea how to fix it. I checkt already other solutions but they are most outdated. Actually i read this issue is being fixt with newer java versions ....
I want to build my game for the Android version 8.1.0 OPM1.171019.011
Answer by liortal · Oct 12, 2018 at 05:20 AM
This question was asked many times before. You can check out my answer to this StackOverflow question
Basically, due to some changes in later versions of the Android SDK, the tools that older Unity versions used from that SDK were modified and so broke the compatibility with Unity. The easiest fix is to manually "downgrade" those tools from your Android SDK to an older version that is supported.
Answer by sferkjh · Oct 12, 2018 at 08:17 PM
Thank you for your answer. Yes it asked many times before. And I checked and tried the other ones already. With no success. But I have an Update. I can build the game by using the command line tool When I set the java version in the console to 1.8. But by the Unity GUI it is still not working. Even if I set the same java version in the "External Tools" Properties.
Your answer
Follow this Question
Related Questions
Android build problems. 2 Answers
CommandInvokationFailure: Failed to re-package resources 0 Answers
Android re-package error - CommandInvokationFailure 0 Answers
WINDOWS 10 DllNotFoundException: sqlite3 0 Answers