Whever I try to debug and deploy my android application (in Android Studio 0.9) I get the following error:
Execution failed for task \':app:packageAllDebugCl
Thread is a bit old, but I got this error too.
My problem was that I used two different com.google.android.gms:play-services Versions in my gradle file.
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-analytics:7.3.0' // WRONG!
Make sure, that you always use same versions like:
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
You are adding a library like this
(A). compile files('libs/YOUR_LIBRARY.jar')
and this library package already available in your code.
comment it like or remove this line
//compile files('libs/YOUR_LIBRARY.jar')
How to know duplicate-copy of library in your project:
unzip your "YOUR_LIBRARY.jar" and see the same class name in your code.
go to File/Invalidate Chaches/Restart
and your problem is solved
1.update google play service
2.add
compile 'com.google.android.gms:play-services-fitness:8.1.0'
compile 'com.google.android.gms:play-services-wearable:8.1.0'
instead of compile 'com.google.android.gms:play-services:8.1.0'
in build.gradle file.
3.
defaultConfig {
multiDexEnabled true
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
tools:overrideLibrary="com.google.android.gms.location, com.google.android.gms.internal"
Did the trick for me (I guess you should change location with whatever google library you use)