15

I am trying to build old unity version(v_4.6.3) project. but i have got a error. already i have got successful result, but current my sdk is updated with latest version.

http://screencast.com/t/u7lNiyoc

Here is my unity error log.

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details. 
C:\Program Files\Java\jdk1.8.0_66\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="E:/Temp/sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

stderr[
Exception in thread "main" java.lang.NoClassDefFoundError: com/android/utils/ILogger
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at SDKMain.main(SDKMain.java:128)
Caused by: java.lang.ClassNotFoundException: com.android.utils.ILogger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
]

stdout[

]

How can i fix this issues. Thank you for advances. Kind Regards.

SiYan Xie
  • 179
  • 1
  • 1
  • 9

1 Answers1

24

The solution to this problem is constantly changing over time as Unity and the Android SDK change.

Note that his problem is presumably fixed in Unity 2017.1.

LATEST SOLUTION

1) For Windows, download "tools_r25.2.3-windows.zip" and unzip it.

2) For MacOSX, download "tools_r25.2.3-macosx.zip" and unzip it.

3) Add the path of the unzipped SDK to the Edit -->Preferences ---> External Tools --->SDK box.

STILL NOT WORKING?

Uninstall SDK Tools 25 and Android SDK Tools 26. Uninstall both SDK Platform-Tools and SDK Tools. Use version number below that.

OLD SOLUTION:

You did not setup your SDK properly.

Follow the steps below to setup your Android SDK.

1. Make sure that there are no spaces in your SDKpath. So create a folder called AndroidSDK in the C directory.

2. Copy your Android-sdk folder to the C:/AndroidSDK directory.

Now, your SDK path should look like this:

C:/AndroidSDK/Android-sdk

3. Update your Android SDK path in the Unity Editor.

Now, check if it works by trying to Build for Android again.

If it fails, continue from below

4. Download the latest Unity version.

5. Re-download SDK then copy the file to C:/AndroidSDK/Android-sdk.

6. Go back to Unity and Update the path

enter image description here

7. Build the Project for Android again, it will show an error and ask you to update SDK.

enter image description here

Click on the "Update Android SDK" buttom. Unity will Automatically update your SDK. Your SDK should then look like something below. Your problem should be gone by now.

enter image description here

Programmer
  • 121,791
  • 22
  • 236
  • 328
  • 2
    This Helped me Unity 5.6.2 And i used For MacOSX, download "tools_r25.2.3-macosx.zip" and unzip it. And Fallowed Old solution Mentioned. It just worked. – bisketashwin Jul 08 '17 at 06:40
  • 2
    I can confirm Unity. 2017.1.2p1 still has this problem on a fresh installed Windows 10. – Guney Ozsan Feb 09 '18 at 19:25
  • @GuneyOzsan It happens on most every new Unity update. I suggest you try the first solution in this answer. I expect it to still work fine – Programmer Feb 09 '18 at 23:13
  • @Programmer Yes SDK tools 25.2.3 worked for me. Sad to see such key points are undocumented. – Guney Ozsan Feb 10 '18 at 21:05
  • It's just that Android SDK keeps changing. You will see this problem more. Hopefully, one day, it will be gone – Programmer Feb 11 '18 at 02:05
  • 1
    I had a similar problem but the solution for me was to set the environment variables: `JAVA_HOME`, `ANDROID_HOME`, `ANDROID_NDK_HOME` and update `PATH`. See [this answer](https://stackoverflow.com/a/49764804/14934). – Mike Henry Apr 11 '18 at 01:03
  • 1
    @MikeHenry Good to know. The installer is supposed to do that for you but failed for some reason. This problem seems to have different solutions depending on the circumstances. I will update this post to reflect that when I have time. – Programmer Apr 11 '18 at 01:13
  • On Unity 2018.1 you'll probably need tools 25.2.5!!! But this answer led me to understand the issue, thanks. – Luishg Jun 08 '18 at 23:24
  • @Luishg The answer keeps changing but it all boils down to the Unity and tool version mostly. Glad you find it helpful – Programmer Jun 08 '18 at 23:58
  • I try this on Unity 2017.4.30f until "update button" but not working... – questionasker Aug 15 '19 at 10:35
  • This solved my issue only by one step: rename my "tools" folder to other name and then copy "tools" of tools_r25.2.3-windows.zip into "Android-sdk". Rebuild your app. Injoy! – Yuanhui Mar 15 '21 at 01:42