我无法解决这个问题,我已经尝试在我的SDK管理器中为版本20到24安装SDK工具。我在运行时遇到此错误
ionic build android
失败:构建因异常而失败。
编译失败;有关详细信息,请参阅编译器错误输出。
我看到这个错误的大多数文章都指向更新SDK工具,这对我没有帮助。
完整输出
Daves-MacBook-Pro:App dvero$ ionic build android
Running command: /Users/dvero/App/hooks/before_prepare/011_readonly.js
/Users/dvero/App
4.0.0
Running command:/Users/dvero/App/hooks/after_prepare/010_add_platform_class.js
/Users/dvero/App
add to body class: platform-android
ANDROID_HOME=/Users/dvero/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
Running: /Users/dvero/App/platforms/android/gradlew cdvBuildDebug -b
/Users/dvero/App/platforms/android/build.gradle -Dorg.gradle.daemon=true
embedded
org.xwalk:xwalk_core_library:16+
:copyCSSFiles
:copyIMGFiles
:copyJSFiles
:fixReferences UP-TO-DATE
:preBuild
:preArmv7DebugBuild
:checkArmv7DebugManifest
:preX86DebugBuild
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac/Users/dvero/App/platforms/android/CordovaLib/src/org/apache/cordova/ResumeCallback.java:42: error: finished has private access in CallbackContext
if (finished) {
^
/Users/dvero/App/platforms/android/CordovaLib/src/org/apache/cordova/ResumeCallback.java:46: error: finished has private access in CallbackContext
finished = true;
^
/Users/dvero/App/platforms/android/CordovaLib/src/org/apache/cordova/ResumeCallback.java:74: error: cannot find symbol
appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, result));
^
symbol: method sendResumeEvent(PluginResult)
location: variable appPlugin of type CoreAndroid
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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: 3.126 secs
ERROR building one of the platforms: Error code 1 for command: /Users/dvero/App/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/dvero/App/platforms/android/build.gradle,-Dorg.gradle.daemon=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /Users/dvero/App/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/dvero/App/platforms/android/build.gradle,-Dorg.gradle.daemon=true
答案 0 :(得分:3)
尝试:
cordova platform update android
之后
ionic build android
它对我有用