Ionic build android finished with non-zero exit value 1

When I was build my app with cli ionic build android ,then I got a error

  • OS : MAC
  • ionic: 1.7.13
  • cordova: 6.0
  • android sdk tools: 24.4.1
  • android sdk platform-tools: 23.1
Running command: /Users/caoshuai/openmind/workspace/zm/hooks/after_prepare/010_add_platform_class.js /Users/caoshuai/openmind/workspace/zm
add to body class: platform-android
ANDROID_HOME=/Users/caoshuai/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
: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
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:compileDebugAidl
:CordovaLib:generateDebugBuildConfig
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets
:CordovaLib:processDebugManifest
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJavaWithJavac注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。

:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
:CordovaLib:bundleDebug
:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues
:generateDebugResources
:mergeDebugResources
AAPT: /Users/caoshuai/openmind/workspace/zm/platforms/android/res/drawable-hdpi/icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT: /Users/caoshuai/openmind/workspace/zm/platforms/android/res/drawable-xxxhdpi/icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT: /Users/caoshuai/openmind/workspace/zm/platforms/android/res/drawable-xhdpi/icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT: /Users/caoshuai/openmind/workspace/zm/platforms/android/res/drawable-ldpi/icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT: /Users/caoshuai/openmind/workspace/zm/platforms/android/res/drawable-xxhdpi/icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT: /Users/caoshuai/openmind/workspace/zm/platforms/android/res/drawable-mdpi/icon.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
:processDebugManifest
: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 '/Users/caoshuai/Library/Android/sdk/build-tools/23.0.1/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.849 secs
ERROR building one of the platforms: Error code 1 for command: /Users/caoshuai/openmind/workspace/zm/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/caoshuai/openmind/workspace/zm/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/caoshuai/openmind/workspace/zm/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/caoshuai/openmind/workspace/zm/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true


I dont know why it’s got falure. is there some one could help ?

As do I, I get the exact same problem.

I get the exact same problem too

I got this fixed by running gradlew assembleDebug --info and it pointed me to a file that it was having trouble with.

I had a node_modules folder in a sub directory and it didn’t like that, after removing the folder everything went through fine.

Hi greenRunning , there are almost 13 folders named node_modules. Which one did you remove? Please specify the path.

In my project I had a www/js/vendor folder with some bower dependancies that I was customising so that they would match the projects needs better and I had a node_modules folder within one of them customised libraries.

The moment I deleted the node_modules folder I stopped getting this error… but I got a different one.

How do you have 13 folders with that name?

When I searched for ‘node_modules’ in my project folder, I found 13 search result in different subdirectories.

I don’t have a vendor folder inside www/js. There is only one file named app.js in that www/js folder.

I use vim check my html file and found some ^H in href attribute of the <a> tag , then I delete them away , problem resolve.

But I still finding the reason why I got ^H in each href value of <a> tag at html file.

Why do you need that many node_modules folders in your directory tree @abdukannur? Might be worth investigating which are necessary and which came bundled with other libraries.

You may think it’s not our preference. Ionic 2 beta goes with more libraries and in one you can go through all the node_modules and never end. This is dependency hole. Just look at webpack and babel. Sometimes it goes wrong with path length, so OS can’t deal with these deep packed files, and I also can’t remove it.

This error went on other day, accidentally, I just don’t know why! It points to Android build tools.