For me it helped to change the version of buildTools to:
buildToolsVersion "21.0.1"
You will find this setting inside the file app/build.gradle
.
You're hitting bug https://code.google.com/p/android/issues/detail?id=42752. The cause usually seems to be a reference to a nonexistent string in one of your menu resources.
For me it was that I forgot to install the 32bit dependencies:
sudo apt-get install -y lib32gcc1 libc6-i386 lib32z1 lib32stdc++6
sudo apt-get install -y lib32ncurses5 lib32gomp1 lib32z1-dev lib32bz2-dev
aapt is 32 bit so will not execute on a 64 bit box until 32 bit architecture is enabled
dpkg --print-foreign-architectures # if prints nothing then below is fix
sudo dpkg --add-architecture i386 # add a 32 bit architecture to box
sudo apt-get install -y lib32gcc1 libc6-i386 lib32z1 lib32stdc++6
sudo apt-get install -y lib32ncurses5 lib32gomp1 lib32z1-dev
it work for me.
I had the same problem and fixed it doing a ./gradlew clean build
! Give it a try and if that doesn't work, try ./gradlew --refresh-dependencies
after and you should be good to go.
My answer may seem a bit too late, but i happened to come across this same error in Android Studio after upgrading the SDK to API 21. I tried all the solutions i came across here on this site and https://code.google.com/p/android/issues/detail?id=61308. Here's how i eventually resoled this error: I opened the app's gradle.build file and changed it from this:
android {
compileSdkVersion 21
buildToolsVersion "21.0.0"
defaultConfig {
applicationId "com.abundantideas.layoutsample"
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
to that:
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.abundantideas.layoutsample"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
I lowered the buildToolsVersion and the targetSdkVersion values back to 20 which i knew was working fine before the upgrade. It looks like API 21 was causing problems for Gradle, in my case. I hope this will help others too.
In my case, I cleaned the project (Menubar -> Build -> Clean Project) and then did the build again. It worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With