Could not find or load main class com.android.sdkmanager.Main

tmporaries picture tmporaries · Dec 8, 2014 · Viewed 12.6k times · Source

I read these, and these, and these issues about Android SDK installation troubles.

Nothing works for me.

Every time I get the error

C:\Users\user\AppData\Local\Android\android-sdk\tools>android
Error: Could not find or load main class com.android.sdkmanager.Main

when I try to start android.bat.

My environment:

C:\Users\user\AppData\Local\Android\android-sdk\tools>java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

JAVA_HOME=c:\Program Files\Java\jdk1.7.0_71\jre\bin

PATH=c:\Program Files\Java\jdk1.7.0_71\jre\bin\;%SystemRoot%\system32;%SystemRoot%;...

I use latest android SDK version (on Dec 8, 2014) - installer_r23.0.2-windows.exe, tried to use latest JDK7 & JDK8 builds. Same error all the time.

How to fix this?

Answer

Francis.TM picture Francis.TM · Apr 23, 2020

Issue:

The JAR required in in the bat file is in path %APP_HOME%\..\lib\sdkmanager-classpath.jar,
but the file was extracted to %APP_HOME%..\lib\_\sdkmanager-classpath.jar, due to an issue in the unzip program used to unzip it.

Solution:

So don't use the Windows' embedded unzip tool. Switch to another, like 7z.
The directory will then be referenced correctly, and you can run sdkmanager.bat without errors.