With the help of this answer, I successfully solved the problem.
We are going to apply a fix in sdkmanager
. It is a shell script. It is located at $android_sdk/tools/bin
, where $android_sdk
is where you unzipped the Android SDK.
- Open
sdkmanager
in your favorite editor. -
Locate the line which sets the
DEFAULT_JVM_OPTS
variable. In my copy, it is at line 31:DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME"'
-
Append the following options to the variable:
-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee
. Please pay attention to the quotes. In my copy, the line becomes:DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
- Save the file and quit the editor.
- Run the command again.
Here is the result:
$ sdkmanager --list
Installed packages:
Path | Version | Description | Location
------- | ------- | ------- | -------
tools | 26.0.1 | Android SDK Tools 26.0.1 | tools/
Available Packages:
Path | Version | Description
------- | ------- | -------
add-ons;addon-g..._apis-google-15 | 3 | Google APIs
add-ons;addon-g..._apis-google-16 | 4 | Google APIs
add-ons;addon-g..._apis-google-17 | 4 | Google APIs
add-ons;addon-g..._apis-google-18 | 4 | Google APIs
add-ons;addon-g..._apis-google-19 | 20 | Google APIs
add-ons;addon-g..._apis-google-21 | 1 | Google APIs
add-ons;addon-g..._apis-google-22 | 1 | Google APIs
add-ons;addon-g..._apis-google-23 | 1 | Google APIs
add-ons;addon-g..._apis-google-24 | 1 | Google APIs
...
Hola! It works!
— Edit: 2017-11-07 —
Please note that you may need to apply the fix above again after running sdkmanager --update
, since the sdkmanager
shell script may be overridden if the tools
package is updated.
Related Answers
- https://stackoverflow.com/a/43574427/142239
- @andy-guibert pointed out the necessary options to make this work. He also briefly what those mysterious options mean.