ionic build android :CordovaLib:compileDebugJavaWi

2019-05-14 09:38发布

问题:

I am unable to figure this out, I have tried installing SDK tools in my SDK manager for versions 20 through 24. I keep getting this error when I run

ionic build android

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.

    Compilation failed; see the compiler error output for details.

Most articles I have seen with this error points to updating SDK tools which is not helping me.

Full output

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

回答1:

Try:

cordova platform update android

and after

ionic build android

It worked for me