5

I'm trying to run the Android SDK manager tool using the following command inside the folder where android-sdk-tools are located.

./sdkmanager

It gives me the following error.

Error: Could not find or load main class com.android.sdklib.tool.SdkManagerCli

Can someone please help with this?

2 Answers2

1

I got this, so I went looking on a system where it worked. The command lives here:

unzip -t Android/Sdk/tools/lib/sdklib-26.0.0-dev.jar | grep sdkman
testing: com/android/sdklib/tool/sdkmanager/   OK
testing: com/android/sdklib/tool/sdkmanager/ListAction.class   OK
...etc

This zip doesn't exist on my bad machine. I have no idea why, and some of the .jar files in there complain about

bad extra-field entry:
  EF block length (0 bytes) invalid (< 4)

but I just copied what I needed from a working machine.

1

Another cleaner way to go about this is to follow the following steps:

  • Go to /path-to-android-sdk/
  • Delete the Tools directory
  • Open Android Studio
  • Open tools -> Sdk Manager
  • Click on the Sdk Tools Tab
  • Uncheck Hide Obsolete Packages
  • Go into the Modal and check Android Sdk Tools (Obsolete)
  • Click Apply
  • Wait While it Downloads....
  • When download is done,go back to /path-to-android-sdk/
  • You should find your tools directory again
  • Everything should work fine now.

Note: What we simply did was delete and replace the old Tools which was corrupted or incompatible

Akintunde
  • 126
  • 3