我想在 android模拟器中运行离子应用。当我尝试在终端中使用以下命令构建离子应用程序时:
ionic build android
它显示以下错误::
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJava'.
> Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 20.383 secs
/home/meutics/ionicapp/ebook- app/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/meutics/ionicapp/ebook-app/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/meutics/ionicapp/ebook-app/platforms/android/build.gradle,-Dorg.gradle.daemon=true
似乎 JAVA_HOME 未正确配置,但我认为我正确配置了 JAVA_HOME 。
在终端窗口中,我运行以下命令::
meutics@meutics-pc:~$ echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk-amd64
在 .bashrc 窗口中,vi ~/.bashrc
export PATH=$PATH:/home/meutics/Downloads/android-studio/bin
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin
export ANDROID_HOME=/home/meutics/Android/Sdk
export PATH=$PATH:$ANDROID_HOME:$ANDROID_HOME/tools:$ANDROID_HOME/build-tools
我该如何解决这个问题?
注意:在/usr/lib/jvm/
目录中,
root@meutics-pc:/usr/lib/jvm# ls
java-1.7.0-openjdk-amd64 java-7-openjdk-amd64 java-8-oracle
java版 ::
meutics@meutics-pc:$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
答案 0 :(得分:0)
只需重新启动你的CLI /终端并以管理员身份运行或在linux上运行sudo ...它对我有用