Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic build android not working on package-resource

My ionic build task isn't working properly.

First, I follow these commands:

ionic start secondApp blank
cd secondApp
ionic platform add android
ionic build android

When ant build prepare to package the project resources, the task throws this error:

-package-resources:
     [aapt] Creating full resource package...

BUILD FAILED
E:\usr\bin\android-sdk\tools\ant\build.xml:932: The following error occurred while executing this line:
E:\usr\bin\android-sdk\tools\ant\build.xml:950: null returned: -1073741819

Total time: 32 seconds

E:\dev\projects\ionic\secondApp\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,E:\dev\projects\ionic\secondApp\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: E:\dev\projects\ionic\secondApp\platforms\android\cordova\build.bat: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\Ricardo\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5)

I already try to clean my project and delete .cordova and .ionic but the problem still persist.

What's wrong?

ANT_HOME, ANDROID_HOME, JAVA_HOME are OK

like image 934
ricardogobbo Avatar asked Oct 19 '14 00:10

ricardogobbo


2 Answers

I encountered the same error. See the following for more information:

https://code.google.com/p/android/issues/detail?id=77629

Downgrading to the Android SDK Build-Tools 20 should allow the build to complete again. That resolved the problem for me.

like image 97
George Heeres Avatar answered Oct 17 '22 20:10

George Heeres


I just retested it with the example ionic project, and it works with SDK Build Tools 21.0.2.

Failing aapt has been fixed for windows/x64 with this version.

So actually upgrading might be an option for you as well.

like image 28
pkk Avatar answered Oct 17 '22 21:10

pkk