Sdkmanager "Error: Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli" on Windows
Open the sdkmanager.bat
in a text editor and add echo %CLASSPATH%
just below the CLASSPATH=%APP_HOME%\...\sdkmanager-classpath.jar
. Then run sdkmanager --help
which will echo the CLASSPATH of the required file. And check whether is it the valid path.
In my case, it was the wrong path,
It said my sdkmanger-classpath.jar
is in lib
folder. But it was not! It was actually inside the lib/_
folder. So as the simple solution what I did was copy the content in side lib/_
folder to lib
. Then it worked fine!
- Download the SDK tools ZIP (Under Command Line Tools in https://developer.android.com/studio).
- Unzip using 7zip. Avoid using the default windows extractor - that doesn't do the extraction correctly.
- After unzipping using 7zip, place the contents into the sdk folder (
C:\Users\<username>\AppData\Local\Android\Sdk\tools\bin
andC:\Users\<username>\AppData\Local\Android\Sdk\lib
) and runsdkmanager
on command prompt.
As @Chrishan wrote Avoid using default windows extractor
.
You can use the PowerShell:
Expand-Archive commandlinetools....zip C:\Android\Sdk