我已经从官方网站下载了Android SDK,安装了openjdk10,将avdmanager shell文件中的变量DEFAULT_JVM_OPTS
更改为:
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
为了使avdmanager与Java 10一起使用,请在我的~/.zshrc
中设置以下环境变量:
- 导出ANDROID_HOME =“ $ HOME / Downloads / android /”
- 导出ANDROID_SDK_HOME =“ $ HOME / .android”
- export JAVA_HOME ='/ usr / lib / jvm / java-10-openjdk'
并使用以下命令下载了SDK:
$ANDROID_HOME/tools/bin/sdkmanager --verbose "system-images;android-25;google_apis;x86"
但是,当我尝试通过以下命令创建新的AVD时:
$ANDROID_HOME/tools/bin/avdmanager create avd -n test -k "system-images;android-25;google_apis;x86"
它仅打印null
并退出。即使我跑步
$ANDROID_HOME/tools/bin/avdmanager
它所做的一切只会输出null。
如果有帮助,我再次更改了avdmanager文件,并添加了一行打印该文件准备的参数的行,然后将其传递给$JAVACMD
命令。参数看起来像这样:
-Dcom.android.sdklib.toolsdir=/home/aonemd/Downloads/android/tools -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee -classpath /home/aonemd/Downloads/android/tools/lib/dvlib-26.0.0-dev.jar:/home/aonemd/Downloads/android/tools/lib/jimfs-1.1.jar:/home/aonemd/Downloads/android/tools/lib/jsr305-1.3.9.jar:/home/aonemd/Downloads/android/tools/lib/repository-26.0.0-dev.jar:/home/aonemd/Downloads/android/tools/lib/j2objc-annotations-1.1.jar:/home/aonemd/Downloads/android/tools/lib/layoutlib-api-26.0.0-dev.jar:/home/aonemd/Downloads/android/tools/lib/gson-2.3.jar:/home/aonemd/Downloads/android/tools/lib/httpcore-4.2.5.jar:/home/aonemd/Downloads/android/tools/lib/commons-logging-1.1.1.jar:/home/aonemd/Downloads/android/tools/lib/commons-compress-1.12.jar:/home/aonemd/Downloads/android/tools/lib/annotations-26.0.0-dev.jar:/home/aonemd/Downloads/android/tools/lib/error_prone_annotations-2.0.18.jar:/home/aonemd/Downloads/android/tools/lib/animal-sniffer-annotations-1.14.jar:/home/aonemd/Downloads/android/tools/lib/httpclient-4.2.6.jar:/home/aonemd/Downloads/android/tools/lib/commons-codec-1.6.jar:/home/aonemd/Downloads/android/tools/lib/common-26.0.0-dev.jar:/home/aonemd/Downloads/android/tools/lib/kxml2-2.3.0.jar:/home/aonemd/Downloads/android/tools/lib/httpmime-4.1.jar:/home/aonemd/Downloads/android/tools/lib/annotations-12.0.jar:/home/aonemd/Downloads/android/tools/lib/sdklib-26.0.0-dev.jar:/home/aonemd/Downloads/android/tools/lib/guava-22.0.jar com.android.sdklib.tool.AvdManagerCli
此外,~/.android
目录仅包含以下三个文件/文件夹:
- adbkey
- adbkey.pub
- 缓存/
我这里缺少什么吗?
答案 0 :(得分:0)
我已经找到问题所在。变量DEFAULT_JVM_OPTS
应该是
DEFAULT_JVM_OPTS='"-Dcom.android.sdkmanager.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
代替
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'