Problem building release .apk (BUILD FAIL)


#1

Hello how are you? i’m trying to build my release .apk and i have a compile error, this error does not happen when building debug .apk.


guido:moove-app guidocelada$ sudo ionic build --release android; sudo chmod -R 777 platforms/;
Password:
Running command: /Users/guidocelada/Development/moove-app/hooks/after_prepare/010_add_platform_class.js /Users/guidocelada/Development/moove-app
add to body class: platform-android
Running command: /Users/guidocelada/Development/moove-app/platforms/android/cordova/build --release
ANDROID_HOME=/Users/guidocelada/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/guidocelada/Development/moove-app/platforms/android/gradlew cdvBuildRelease -b /Users/guidocelada/Development/moove-app/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:preReleaseBuild
:checkReleaseManifest
:CordovaLib:compileLint
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preReleaseBuild
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:compileReleaseJava UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:packageReleaseJar UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:packageReleaseJniLibs UP-TO-DATE
:CordovaLib:packageReleaseLocalJar UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedReleaseLibrary UP-TO-DATE
:preDebugBuild
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preDebugBuild
: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:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:prepareComAndroidSupportMultidex100Library UP-TO-DATE
:prepareComAndroidSupportSupportV132311Library UP-TO-DATE
:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:prepareComFacebookAndroidFacebookAndroidSdk4100Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGcm830Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library UP-TO-DATE
:prepareReleaseDependencies
:compileReleaseAidl UP-TO-DATE
:compileReleaseRenderscript UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:generateReleaseAssets UP-TO-DATE
:mergeReleaseAssets UP-TO-DATE
:generateReleaseResValues UP-TO-DATE
:generateReleaseResources UP-TO-DATE
:mergeReleaseResources UP-TO-DATE
:processReleaseManifest UP-TO-DATE
:processReleaseResources UP-TO-DATE
:generateReleaseSources UP-TO-DATE
:compileReleaseJava/Users/guidocelada/Development/moove-app/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:297: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
^
symbol: variable KITKAT
location: class VERSION_CODES
/Users/guidocelada/Development/moove-app/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:301: error: cannot find symbol
inAppWebView.evaluateJavascript(finalScriptToInject, null);
^
symbol: method evaluateJavascript(String,)
location: variable inAppWebView of type WebView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileReleaseJava’.

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: 20.576 secs

/Users/guidocelada/Development/moove-app/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/guidocelada/Development/moove-app/platforms/android/gradlew with args: cdvBuildRelease,-b,/Users/guidocelada/Development/moove-app/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/guidocelada/Development/moove-app/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/guidocelada/Development/moove-app/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)


Ionic CLI is out of date:



guido:moove-app guidocelada$ sudo ionic build android; sudo chmod -R 777 platforms/;
Running command: /Users/guidocelada/Development/moove-app/hooks/after_prepare/010_add_platform_class.js /Users/guidocelada/Development/moove-app
add to body class: platform-android
Running command: /Users/guidocelada/Development/moove-app/platforms/android/cordova/build
ANDROID_HOME=/Users/guidocelada/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/guidocelada/Development/moove-app/platforms/android/gradlew cdvBuildDebug -b /Users/guidocelada/Development/moove-app/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
: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:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:preReleaseBuild
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:compileReleaseJava UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:packageReleaseJar UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:packageReleaseJniLibs UP-TO-DATE
:CordovaLib:packageReleaseLocalJar UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:prepareComAndroidSupportMultidex100Library UP-TO-DATE
:prepareComAndroidSupportSupportV132311Library UP-TO-DATE
:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:prepareComFacebookAndroidFacebookAndroidSdk4100Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGcm830Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:compileDebugJava UP-TO-DATE
:preDexDebug UP-TO-DATE
:dexDebug UP-TO-DATE
:processDebugJavaRes UP-TO-DATE
:validateDebugSigning
:packageDebug UP-TO-DATE
:zipalignDebug UP-TO-DATE
:assembleDebug UP-TO-DATE
:cdvBuildDebug UP-TO-DATE

BUILD SUCCESSFUL

Total time: 5.185 secs
Built the following apk(s):
/Users/guidocelada/Development/moove-app/platforms/android/build/outputs/apk/android-debug.apk