I don't have a lot of experience with Android or Java. When I try to build to Android device I get this error: I have the latest version of Android Studio along with all its tools and stuff, I also installed Java 8. How can I fix this?
should be fixed if you remove jdk9 and use jdk8, can you post the full console error (it shows version there) https://issuetracker.unity3d.com/is...jdk-and-unable-to-list-target-platforms-error
Check Edit -> Preferences -> External Tools to see if you have the path set up there. If not you're going to want to fill out both the SDK and JDK directories.
I restarted unity and it worked, but now it freezes on the "Packaging Assets" phase while building. I restarted 3 times and same thing. I deleted the library folder and let unity generate it again and also turned off the global baked lighting thing.
I am experiencing the same problem using JKD8-152. The error is: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. C:/Android/sdk\tools\bin\avdmanager.bat list target -c stderr[ Exception in thread "main" java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()Ljava/lang/String; at com.android.sdklib.tool.AvdManagerCli.init(AvdManagerCli.java:278) at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:210) at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200) ] stdout[ I can replicate the java error via the commandline, so it seems to be a problem with the Android installation. The funny thing is that it only fails in 2017.3 (both f3 and p1) but not in 2017.2. Same project. Same Android settings in preferences. So apparently 2017.3 also have another way of detecting the target platform - or need to do it where 2017.2 did not.
Ok. So I fixed it by renaming the avdmanager.bat file as I noticed that it was not present on one of my other platforms that build fine. I don't know what I have broken in Android tooling doing that, but at least Unity can build now.
I've got exactly the same Error and your solution worked. Who knows if that messes up my Android Studio for other purposes, but it did the trick. Thank you! I wonder if this problem is listed somewhere in the release notes, how can the Unity development team not notice such a basic problem?
Please check the pinned threads. https://forum.unity.com/threads/java-9-jdk-9-support-by-unity-android.499354/
Hi, im having the same annoying issue but im clueless as to what is not being found - the JDK or the SDK. Prior to seeing this post, i was using unity 2017.1.0f3, and could not get unity to build to android using SDK tools from version 24.0.0 to 28.0.2. I was using JDK10. I installed to unity 2018.2.0F2, same problem occurred. Saw this post, removed all JDKS, installed JDK8 update 181, uninstalled Android Studio, reinstalled andriod studio and its default SDK. I still get the same error. CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. B:/Work/Java\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/Users/Red2Black/AppData/Local/Android/Sdk\tools" -Dfile.encoding=UTF8 -jar "B:\Work\Unity 2018.2.0f2\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" I dont know what to do, Im dying inside out.
What is the output of B:/Work/Java\bin\java.exe -version ? What is the output of java -version when the current directory is, for example, B:?
Had the same issue. Fixed by installing JDK 8. Note, even though java.exe -version reported 8, the other version was still interfering. I had to uninstall JDK 10 and suddenly it worked.
Correct. Oracle installations add latest java executable to your PATH, which interferes with Android SDK.
if changing to jdk 8 don't work, you can also try to download an earlier version of the sdk tool folder http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip here's a video tutorial