问题描述
使用Java 11(不是Studio,仅是SDK工具)运行Android sdkmanager
时遇到问题.我不想安装JDK 8或类似的东西.有没有办法用JDK 11修复Android sdkmanager
的问题?
I am facing a problem while running Android sdkmanager
with Java 11 (Not studio, only SDK tools). I don't want to install JDK 8 or something similar. Is there a way to fix this for Android sdkmanager
with JDK 11?
我已经通过此答案并且它不提供针对Java 11的命令行修复.还有其他解决方法吗?
I have gone through this answer and it doesn't offer command line fix for java 11. Any other workaround possible?
推荐答案
如果有人要在Java 11上寻找Linux修复程序,那么我将在以前的答案的基础上构建它
If anyone is looking for a Linux fix on Java 11. I built this on top of previous answers
cd Android/tools
mkdir jaxb_lib
wget https://repo1.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar -O jaxb_lib/activation.jar
wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.3/jaxb-impl-2.3.3.jar -O jaxb_lib/jaxb-impl.jar
wget https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.11/istack-commons-runtime-3.0.11.jar -O jaxb_lib/istack-commons-runtime.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-xjc/2.3.3/jaxb-xjc-2.3.3.jar -O jaxb_lib/jaxb-xjc.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar -O jaxb_lib/jaxb-core.jar
wget https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.3/jaxb-jxc-2.3.3.jar -O jaxb_lib/jaxb-jxc.jar
wget https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar -O jaxb_lib/jaxb-api.jar
下载完成(确保所有文件都已下载确定)之后,您必须在tools/bin目录中编辑sdkmanager和avdmanager脚本.您可以手动或自动执行此操作.
After the download finishes (make sure all files were downloaded OK), you have to edit sdkmanager and avdmanager scripts in the tools/bin directory. You can do this manually or automatically.
Simon Ruggier回答:
From Simon Ruggier answer:
sed -ie 's%^CLASSPATH=.*%\0:$APP_HOME/jaxb_lib/*%' bin/sdkmanager bin/avdmanager
或者手动向下滚动到CLASSPATH变量,并添加我们刚刚下载的新jar,如下所示:
Or manually, scroll down to the CLASSPATH variable, and add the new jars we just downloaded like this:
CLASSPATH=$APP_HOME/jaxb_lib/activation.jar:$APP_HOME/jaxb_lib/jaxb-impl.jar:$APP_HOME/jaxb_lib/jaxb-xjc.jar:$APP_HOME/jaxb_lib/jaxb-core.jar:$APP_HOME/jaxb_lib/jaxb-jxc.jar:$APP_HOME/jaxb_lib/jaxb-api.jar:<etc etc...DO NOT REMOVE THE OTHER JARS!...>
这篇关于使Android sdkmanager与Java 11一起运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!