Android Gradle Project upgrading build tools to 21.0.1: aapt throws Exception Android Gradle Project upgrading build tools to 21.0.1: aapt throws Exception android android

Android Gradle Project upgrading build tools to 21.0.1: aapt throws Exception


This worked for me:

It's metadata added by tools like Photoshop that isn't even honored by Android. Strip it.

brew install exiftoolfind . -path '*src/main/res/*' -name '*.png' -exec exiftool -overwrite_original -all= {} \;

Source: https://groups.google.com/forum/#!msg/adt-dev/rjTQ_STR3OE/-UcNQRISTKsJ

P.S. Tested on Mac only.


This is caused by a faulty aapt. There was a similar problem in 21.0.0 too (Error Code: -1073741819). You need to update build-tools again to fix it.

  • Open SDK manager and install build-tools 21.1.2.

  • Then change your build.gradle so that it looks like this.

    apply plugin: 'com.android.application'    android {        compileSdkVersion 21        buildToolsVersion "21.1.2"

Replace version numbers with the most recent ones as necessary.

Old buildToolsVersion 21.0.2, recommended version is 21.1.2 or later


Warnings about libpng are reported here but can be ignored

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

Project Member says the newer libpng they built against is stricter about the color profile. They will fix this in an upcoming release, but this shouldn't be an issue.

And 21.0.2 solves other issues.