【问题标题】:Trying to build Android Emulator with ionic fails.. "Class not found: javac1.8" [duplicate]尝试使用离子构建Android模拟器失败..“找不到类:javac1.8”[重复]
【发布时间】:2014-04-26 12:54:42
【问题描述】:

我正在尝试使用 ionic 框架的“ionic emulate 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

有没有人知道是什么导致了这个问题?谢谢

【问题讨论】:

    标签: java android cordova ant


    【解决方案1】:

    主要问题是 ant javac1.8 class not found

    如果更改使用的ant版本不方便,使用Java 6或7即可。

    【讨论】:

    • 使用“brew update”后跟“brew install ant”来获取最新版本。我很困惑并开始执行 npm install ant,这是完全错误的
    • 我得到了同样的错误,但使用的是 ant 1.10.1 ?我的Java是jdk1.8.0_112
    【解决方案2】:

    这对我有用,设置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>
    

    【讨论】:

    猜你喜欢
    • 2014-08-01
    • 2016-06-17
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-05
    相关资源
    最近更新 更多