由于 JDK-9,无法使用 ionic 构建 android
Unable to build android with ionic due to JDK-9
我有一个 ionic 2.0.0-rc0
应用程序,我想构建 n 个 android 平台。当我 运行
ionic run android
,它在两者之间失败。 StackTrace-
> ionic-hello-world@ build /home/raj/ionic/github
> ionic-app-scripts build
[07:46:11] ionic-app-scripts 0.0.23
[07:46:11] build prod started ...
[07:46:11] clean started ...
[07:46:11] clean finished in 9 ms
[07:46:11] copy started ...
[07:46:11] ngc started ...
[07:46:11] lint started ...
[07:46:11] copy finished in 171 ms
[07:46:12] lint finished in 960 ms
[07:46:26] ngc finished in 15.36 s
[07:46:26] bundle prod started ...
[07:46:34] bundle prod finished in 8.27 s
[07:46:34] sass started ...
[07:46:36] sass finished in 1.67 s
[07:46:36] minify started ...
[07:46:36] cleancss started ...
[07:46:36] uglifyjs started ...
[07:46:47] uglifyjs finished in 10.80 s
[07:46:47] cleancss finished in 10.80 s
[07:46:47] minify finished in 10.80 s
[07:46:47] build prod finished in 36.12 s
Running command: /home/raj/ionic/github/hooks/after_prepare/010_add_platform_class.js /home/raj/ionic/github
:CordovaLib:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
Error: /home/raj/ionic/github/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> Could not create an instance of type com.sun.tools.javac.api.JavacTool.
我正在使用 genymotion 作为模拟器,尽管我认为这在这个问题上并不重要。许多解决此问题的方法是设置 JAVA_HOME
路径。但是我已经设置了,
echo $JAVA_HOME > /usr/lib/jvm/java-9-openjdk-amd64
。我怀疑这是 gradle 2.1
和 this 中的 java-9
的问题。我已经坚持了一段时间了,任何帮助将不胜感激。
cordova platform update android
ionic build android
ionic run android
尝试运行这些命令。希望这会对你有所帮助:)
愚蠢的我认为尝试 JDK-9
是个好主意
Oracle 警告我不要。删除它并安装 JDK-8
,问题解决了。 Oracle 确实看到了我的未来。
我有一个 ionic 2.0.0-rc0
应用程序,我想构建 n 个 android 平台。当我 运行
ionic run android
,它在两者之间失败。 StackTrace-
> ionic-hello-world@ build /home/raj/ionic/github
> ionic-app-scripts build
[07:46:11] ionic-app-scripts 0.0.23
[07:46:11] build prod started ...
[07:46:11] clean started ...
[07:46:11] clean finished in 9 ms
[07:46:11] copy started ...
[07:46:11] ngc started ...
[07:46:11] lint started ...
[07:46:11] copy finished in 171 ms
[07:46:12] lint finished in 960 ms
[07:46:26] ngc finished in 15.36 s
[07:46:26] bundle prod started ...
[07:46:34] bundle prod finished in 8.27 s
[07:46:34] sass started ...
[07:46:36] sass finished in 1.67 s
[07:46:36] minify started ...
[07:46:36] cleancss started ...
[07:46:36] uglifyjs started ...
[07:46:47] uglifyjs finished in 10.80 s
[07:46:47] cleancss finished in 10.80 s
[07:46:47] minify finished in 10.80 s
[07:46:47] build prod finished in 36.12 s
Running command: /home/raj/ionic/github/hooks/after_prepare/010_add_platform_class.js /home/raj/ionic/github
:CordovaLib:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
Error: /home/raj/ionic/github/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> Could not create an instance of type com.sun.tools.javac.api.JavacTool.
我正在使用 genymotion 作为模拟器,尽管我认为这在这个问题上并不重要。许多解决此问题的方法是设置 JAVA_HOME
路径。但是我已经设置了,
echo $JAVA_HOME > /usr/lib/jvm/java-9-openjdk-amd64
。我怀疑这是 gradle 2.1
和 this 中的 java-9
的问题。我已经坚持了一段时间了,任何帮助将不胜感激。
cordova platform update android
ionic build android
ionic run android
尝试运行这些命令。希望这会对你有所帮助:)
愚蠢的我认为尝试 JDK-9
是个好主意
Oracle 警告我不要。删除它并安装 JDK-8
,问题解决了。 Oracle 确实看到了我的未来。