Gradle error while building ionic project


#1

Hello you geeks
i created a project on ionic creator then exported it with ionic cli to my pc (ubuntu 15.04).
now when i tried to build an android apk got very annoying gradle error. i ve done many searches and tried many ways but nothing …
command and error is:

[code]user@user-Lenovo-E40-70:~/workspace/iaut$ ionic build android
Running command: /home/user/workspace/iaut/hooks/after_prepare/010_add_platform_class.js /home/user/workspace/iaut
add to body class: platform-android
ANDROID_HOME=/home/user/bin/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/oracle_jdk8
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary 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 FAILED

FAILURE: Build failed with an exception.

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

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/home/user/bin/android-sdk-linux/build-tools/23.0.2/aapt’’ finished with non-zero exit value 1

  • 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: 2.855 secs
ERROR building one of the platforms: Error code 1 for command: /home/user/workspace/iaut/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/user/workspace/iaut/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /home/user/workspace/iaut/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/user/workspace/iaut/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true[/code]

any help will be appreciated
thank you


#2

Getting same error

FAILURE: Build failed with an exception.

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

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/root/Android/Sdk/build-tools/23.0.2/aapt’’ finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

#3

FAILURE: Build failed with an exception.

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

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Users/andrewhawken/Library/Android/sdk/build-tools/23.0.2/aapt’’ finished with non-zero exit value 1

  • 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: 6.15 secs
ERROR building one of the platforms: Error code 1 for command: /Users/andrewhawken/src/jbf-sports-clientframework/src/ionic/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/andrewhawken/src/jbf-sports-clientframework/src/ionic/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /Users/andrewhawken/src/jbf-sports-clientframework/src/ionic/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/andrewhawken/src/jbf-sports-clientframework/src/ionic/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

Cordova CLI: 6.0.0
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.0
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
ios-deploy version: 1.8.3
ios-sim version: 5.0.4
OS: Mac OS X El Capitan
Node Version: v5.2.0
Xcode version: Xcode 7.2.1 Build version 7C1002


#4

Did you fixed this error?


#5

Fix would be a kind description, I removed a lot of my unnecessary bower components that get copied to my ./www/lib folder and it resolved the issue with building.


#6

I found the solution. Actually i was using plugin phonegap-plugin-push. Which requires upgrade of android sdk. I upgraded sdk. Now it works perfect.


#7

@developersnepal, Please how was this upgrade (which files did you downloaded), mine does not seem to work


#9

Make sure all the checked sdks are installed.


#10

I just installed all the files under tools and all of the Android 6.0 (API 23) , but still the error still comes up. Which files are key for cordova to run?