我正在尝试使用离子框架的“离子模拟android”命令来模拟android。
但它引发了异常..
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
BUILD FAILED
C:\adt-bundle-windows-x86-20131030\sdk\tools\ant\build.xml:601: The following er
ror occurred while executing this line:
C:\adt-bundle-windows-x86-20131030\sdk\tools\ant\build.xml:720: The following er
ror occurred while executing this line:
C:\adt-bundle-windows-x86-20131030\sdk\tools\ant\build.xml:734: Class not found:
javac1.8
Total time: 1 second
C:\PhoneApps2\myApp2\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\PhoneApps2\myApp2
\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Colin\AppData\Roaming\npm\node_modules\co
rdova\src\superspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:730:16)
at Process.ChildProcess._handle.onexit (child_process.js:797:5)
Unable to emulate app on platform android. Please see console for more info.
我在系统变量中安装了最新版本的JRE和JDK;
JRE_HOME: C:\Program Files (x86)\Java\jre8
JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0
ANT_HOME: C:\Users\Colin\AppData\Roaming\npm\node_modules\ant\ant
PATH: ...;%ANT_HOME%\bin;%PATH%\tools;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin;%JRE_HOME%\bin
是否有人知道可能导致此问题的原因?谢谢
答案 0 :(得分:12)
主要问题是蚂蚁< 1.9.0不支持Java 8.请参阅此处接受的答案:
javac1.8 class not found
如果更改使用的ant版本不方便,使用Java 6或7将起作用。
答案 1 :(得分:5)
这对我有用,设置为compiler="javac1.6"
或compiler="javac.17"
。
当然你必须安装java1.6 / 1.7。
<target name="compile">
<javac srcdir="src" destdir="build/classes" source="1.6" target="1.6" compiler="javac1.6">
<classpath>
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</classpath>
</javac>