'Unable to install Android build-tools with sdkmanager

I'm trying to build android applications with the command line tools in Windows 10. I was able to install the platform tools and the platform with the sdkmanager with no problem and also accepted all of the licenses.

But when I try to install the build tools using this command ./sdkmanager --sdk_root=C:/Android --verbose "build-tools;27.0.3" it fails and I get these messages running on verbose:

Info: Parsing C:\Android\cmdline-tools\4.0\package.xml
Info: Parsing C:\Android\platform-tools\package.xml
Info: File C:\Users\PC\.android\repositories.cfg could not be loaded.

Warning: Dependant package with key emulator not found!
Warning: Unable to compute a complete list of dependencies.

I found this question which had the same warning: Error "Dependent package with key emulator not found" while updating Android SDK and tools

But it seems that the emulator package doesn't exist anymore and I don't think it has to do with why I am unable to install the build-tools

Any help will be appreciated.



Solution 1:[1]

  1. Open the bin folder

  2. On the location bar at the top, remove everything for it and type cmd

  3. Now type this command:- sdkmanager.bat "build-tools;latest" --sdk_root=../

  4. After this command, type this command:- sdkmanager.bat "platforms;android-32" --sdk_root=../

NOTE - Upper command android-32.0.0 is based on the time I am typing this

And this will work in most the cases, or try reinstalling or consider watching the video tutorials on YouTube

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1