Reputation: 1553
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?
Upvotes: 11
Views: 16073
Reputation: 12677
On Windows Server 2019, as of commandlinetools-win-6609375_latest.zip we were facing same issue. We placed package inside "Program Files" i.e. "C:\Program Files\Android\cmdline-tools\tools\bin".
It seems this will not work if there is space in path. So we placed it in folder path without spaces i.e. "C:\Android\cmdline-tools\tools\bin" and it is working fine.
As explained in Sdkmanager "Error: Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli" on Windows
Upvotes: 0
Reputation: 1253
Downloading the latest SDK fixed it for me - Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli
Upvotes: 0
Reputation: 125
I fixed the problem by setting the correct folder hierarchy. which is ANDROID_HOME>cmdline-tools>tools
Copy the tools folder which contain all the files of command line tools into a folder named cmdline-tools. Then it will work.
The tools installed using sdkmanager (eg platform-tools) will be installed in the folder which contains the cmdline-tools folder, in my case ANDROID_HOME folder
Upvotes: 0
Reputation: 21
The solution to this is during the initial extraction of .zip file for version '6200805'.
Extract using 7zip or any other extraction tool. The Windows standard "Extract All..." option create a folder with name "-" under the .\tools\lib path and places all jar files there causing the issue.
Hope this helps.
Upvotes: 0
Reputation: 1801
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.
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.
Upvotes: 11
Reputation: 21
I think the latest version '6200805' has some issue, even I got the same problem.
Solution: Use the older SDK manager version, please find below links for the older version.
Windows no installer: https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip
MacOSX: https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip
Linux: https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
Upvotes: 2
Reputation: 3765
A clean way to go about this is to follow the following steps:
/path-to-android-sdk/
Tools
directorySdk Tools
TabHide Obsolete Packages
Android Sdk Tools (Obsolete)
Apply
/path-to-android-sdk/
Note: What we simply did was delete and replace the old Tools which was corrupted or incompatible
Upvotes: 7
Reputation: 1
I fixed this by opening sdkmanager.bat file find this line
Change this line
set CLASSPATH=%APP_HOME%\lib\/sdkmanager-classpath.jar
To
set CLASSPATH=%APP_HOME%\lib\_\/sdkmanager-classpath.jar
Upvotes: 0
Reputation: 52
Make sure you have all the required Android SDK packages installed too, these include SDK Platform 25, Android SDK Build-Tools 25.0.2 or later, Android Support Repository, Google Repository and any other SDKs that you may need. OR Try To Reinstall
Upvotes: 0
Reputation: 870
Look for sdkmanager.jar
. This file should be located in the ...tools\lib
folder. According to the content of the executed android.bat
:
...
set jar_path=lib\sdkmanager.jar;lib\swtmenubar.jar
...
In my case, I also had a /lib_cc folder which contained the missing files. The problem was fixed with backed up the origin /lib
file to /lib_1
and copy of /lib_cc
to /lib
.
Upvotes: 0