Couldn't build Android App
Hi Folks,
I'm trying to build a little test App for Android. But currently I can't build Android apps cause of this error.
"CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. C:/Users/patri/AppData/Local/Android/sdk\tools\bin\avdmanager.bat list target -c stderr[ Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156) at com.android.repository.api.SchemaModule.(SchemaModule.java:75) at com.android.sdklib.repository.AndroidSdkHandler.(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:185) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ... 5 more ] stdout[ ] exit code: 1 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit) UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector) UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)"
Does anyone has a idea what's causing this issue?
I'm using Unity 2017.3 and tle latest Installation/Updates of Android Studio
NDK: "android-ndk-r13b"
Java SDK: jdk-9.0.1
Thanks in advance
Kind reguards,
Dantorius
Answer by pako · Jan 14, 2018 at 06:49 PM
Unity is currently incompatible with JDK 9.0.1. Downgrade to JDK 8.
https://forum.unity.com/threads/java-9-jdk-9-support-by-unity-android.499354/
Answer by riku_hei · Jun 24, 2020 at 08:28 AM
I solved the problem by changing the path of the JDK from C:/Users/user/Files/Unity/2019.3.15f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK to C:/Users/userFiles/Unity/2019.3.15f1/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK (See the last slash mark)
Thanks a lot ! Still not fixed by unity in Nov 2020 .......
Actually, this seems to have been fixed since Unity 2018.3, because OpenJDK ships together with Unity by default. See the UPDATE remark in the above forum post.
Additionally, in my Unity 2020.1.8 installation, the JDK path is C:\Program Files\Unity\Hub\Editor\2020.1.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
i.e. no forward slash-backslash error per @riku_hei answer above.
But if you're on a 2019 version, you should be using the latest one 2019.4.15f1 (LTS).
I was on 2019.4.12f1 and after many and many and many building the error comes out of nowhere, so I've updated to 2019.4.15f1, but the error was still there. Riku_Hei's fix solve my problem.
I had the exact same issue with Unity 2019.4.25f1 on Windows 10. Thank you !
Had this issue with the backslashes/forwardslashes in 2021.2.0b2 Win10Pro \(〇_o)/
Your answer
Follow this Question
Related Questions
No Java runtime present, requesting install. 1 Answer
Google Cast - Android Build fails 0 Answers
How to solve this build Error? 1 Answer
Unable to build Google VR app for Android 0 Answers
Android Unable to merge manifest Error 2 Answers