Warning:The android.dexOptions.incremental property is deprecated
and it has no effect on the build process.
/home/midhilaj/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/be3106efb0df111fe5a3f7b356dd070b/res/values/values.xml
Error:(246, 5) error: resource android:attr/fontVariationSettings not
found.
/project/bkup/7_march_2018/hyshoper/milla/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml
Error:(246, 5) error: resource android:attr/ttcIndex not found.
Error:(269) resource android:attr/ttcIndex not found. Error:(269)
resource android:attr/fontVariationSettings not found.
Error:java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:failed linking references.
Error:java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error:
check logs for details Error:Execution failed for task
':milla:processDebugAndroidTestResources'.
Failed to execute aapt Information:9 errors Information:BUILD FAILED in 2s Information:1 warning Information:See complete output in console
How to solve this issue?
my dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'de.hdodenhof:circleimageview:2.2.0'
compile('com.alibaba.android:ultraviewpager:1.0.6.1#aar') {
transitive = true
}
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'com.synnapps:carouselview:0.1.4'
compile 'com.sun.mail:android-mail:1.5.5'
compile 'com.sun.mail:android-activation:1.5.5'
implementation 'com.muddzdev:styleabletoast:2.0.2'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'me.grantland:autofittextview:0.2.+'
// base library
//slider
compile 'com.ss.bannerslider:bannerslider:1.8.0'
//noinspection GradleCompatible
compile 'jp.wasabeef:recyclerview-animators:2.2.7'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.satyan:sugar:1.4'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:percent:26.1.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.satyan:sugar:1.4'
compile 'jp.wasabeef:recyclerview-animators:2.2.6'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
compile 'com.afollestad.material-dialogs:core:0.9.4.2'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.google.android.gms:play-services-auth:9.8.0'
compile 'com.google.android.gms:play-services-location:9.8.0'
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-config:9.8.0'
compile 'com.google.firebase:firebase-crash:9.8.0'
compile 'com.google.firebase:firebase-invites:9.8.0'
compile 'com.google.firebase:firebase-storage:9.8.0'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'at.blogc:expandabletextview:1.0.3'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.+'
compile 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
implementation 'com.android.support:design:26.1.0'
}
try to change the compileSdkVersion to:
compileSdkVersion 28
fontVariationSettings added in api level 28. Api doc here
This is caused by an incompatibility with the android support library that changed to version 28. I solved the problem by forcing the build to use a lower support library. //like build gradle
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
My project built successfully immediately after I changed this. Hope this might help you too. I lost a day of development because of this!.
For those that must keep compileSdkVersion 27 and are unable to upgrade to androidx yet, you must not upgrade to (or over) the versions of dependencies in the following links. These links are where the breaking change was introduced. You must find an earlier version that doesn't use androidx.
https://firebase.google.com/support/release-notes/android#update_-_june_17_2019
https://developers.google.com/android/guides/releases#june_17_2019
For instance, the following are compatible with compileSdkVersion 27:
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
}
The following will break with compileSdkVersion 27 and are only compatible with compileSdkVersion 28:
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-messaging:19.0.0'
}
If you are updating to v28
change the compileSdkVersion to compileSdkVersion 28
I solve this problem with the line below:
cordova plugin add cordova-android-support-gradle-release --save
After that the compile was succesful.
For native Android apps (not Cordova) solution for me is:
Was:
implementation 'com.android.support:support-v13:+'
Now:
implementation 'com.android.support:support-v13:27.1.1'
#All the issue is because of the latest major breaking changes in the google play service and firebase June 17, 2019 release.
If you are on Ionic or Cordova project. Please go through all the plugins where it has dependency google play service and firebase service with + mark
Example:
In my firebase cordova integration I had
com.google.firebase:firebase-core:+
com.google.firebase:firebase-messaging:+
So the plus always downloading the latest release which was causing error. Change + with version number as per the March 15, 2019 release https://developers.google.com/android/guides/releases
Make sure to replace + symbols with actual version in build.gradle file of cordova library
Another fix for Ionic 3 devs is to create build-extras.gradle
inside platforms/android and put following
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
Note that build-extras.gradle is not the same as build.gradle
after upgrading to Android 3.4.2 and FTC SDK5.2. I got these errors when building APK:
Android resource linking failed
C:\Users\idsid\FTC\SkyStone\TeamCode\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1205: error: resource android:attr/fontVariationSettings not found.
C:\Users\idsid\FTC\SkyStone\TeamCode\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1206: error: resource android:attr/ttcIndex not found.
error: failed linking references.
What I did is to add following section to project build gradle and problem is fixed.
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion '29.0.2'
}
}
}
}
Good luck.
I encountered this error in a flutter project and all I had to do update my compileSdkVersion to 28.
STEPS:
In your app level build.gradle file, search for compileSdkVersion
Check the current version
If less than 28, update it to 28
As zyc zyc stated above, the property fontVariationSettings was added in API level 28.
You can also read more about it here
Usually it's because of sdk versions and/or dependencies.
For Cordova developers, put your dependencies settings in "project.properties" file under CORDOVA_PROJECT_ROOT/platforms/android/ folder, like this:
target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:26.1.0
cordova.gradle.include.2=cordova-plugin-googlemaps/app-tbxml-android.gradle
cordova.system.library.3=com.android.support:support-core-utils:26.1.0
cordova.system.library.4=com.google.android.gms:play-services-maps:15.0.0
cordova.system.library.5=com.google.android.gms:play-services-location:15.0.0
So if you use CLI "cordova build", it will overwrite the dependencies section:
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
/* section being overwritten by cordova, referencing project.properties */
...
// SUB-PROJECT DEPENDENCIES END
}
If you are using proper libraries and its versions in project.properties, you should be fine.
This was a pain in the ass for me! Especially after updating to Android Studio 3.2.1 and Gradle 4.6 (for Gradle developers).
I think there is more than one factor that could cause such a build exception. For me, I had the following lines of code in my gradle.properties file (using SDK version 27):
android.useAndroidX=true
android.enableJetifier=true
AndroidX is the alternative to Android's default Support Library and should be used when compiling and targeting SDK version 28 (API 28). Before the updating Android Studio and Gradle, I had added the lines above in preparation to eventually fully migrate to AndroidX to use SDK version 28 and the build ran successfully. It was only after the update that I received an error similar to that above:
error: resource android:attr/fontVariationSettings not found
Hope this helps.
If you have stumbled upon this problem due to getting this error recently out of nowhere in react native- this is due to the latest BREAKING CHANGE in Google Play service and Firebase. Check this thread first -
https://github.com/facebook/react-native/issues/25293
And solution would mostly be like this -
https://github.com/facebook/react-native/issues/25293#issuecomment-503045776
I had the same error, but don't know why it appeared. After searching solution I migrated project to AndroidX (Refactor -> Migrate to AndroidX...) and then manually changed whole classes imports etc. and in layout files too (RecyclerViews, ConstraintLayouts, Toolbars etc.).
I changed also compileSdkVersion and targetSdkVersion to 28 version and whole project/application works fine.
If anybody has this error using phonegap or cordova with the cordova-plugin-fcm-ng or cordova-plugin-fcm plugin, the solution that worked for me is creating the extra config file for gradle "build-extras.gradle" in the \platforms\android\app folder, and putting the following lines in it
configurations.all {
resolutionStrategy {
force 'com.google.firebase:firebase-messaging:18.0.0'
force 'com.google.firebase:firebase-core:16.0.8'
}
}
I found this solution reading this page https://github.com/facebook/react-native/issues/25371, in particular comment of shreyakupadhyay on 30/07/19 and consulting https://developers.google.com/android/guides/releases#may_07_2019 about last libraries version.
error: resource android:attr/fontVariationSettings not found
I got this error when i added ButterKnife library but upgrading compileSdkVersion to 28 and targetSdk to 28 solved my issue.
I had this problem suddenly happening after trying to pull a dependency depending on sdk 28 (firebase crashlytics), but then decided to revert back the changes.
I tried automatic refactor Migrate to Androidx (which do half the job), added android.useAndroidX=true in gradle.properties at some points, and make the project work again.
But it was a lot of changes before a delivery. There was no way to have the project compile again with SDK 27. I git clean -fd, removed $HOME/.gradle, and kept seeing androidx in ./gradlew :app:dependencies
I ended up removing ~/.AndroidStudio3.5/ too (I'm on 3.5.3). This makes the project compile again, and I discovered the dark mode...
For Ionic 3 devs. I had to update the platforms/android/project.properties file ONLY on:
cordova.system.library.2
to be v4:28.0.0+ otherwise the build kept failing.
After doing so, my project.properties file contents are shown below:
target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.android.support:support-v4:28.0.0+
cordova.system.library.3=com.android.support:support-v4:+
cordova.system.library.4=com.android.support:support-v4:25.+
cordova.system.library.5=com.android.support:appcompat-v7:25.+
cordova.gradle.include.1=cordova-plugin-googlemaps/starter-tbxml-android.gradle
cordova.system.library.6=com.google.android.gms:play-services-maps:15.0.1
cordova.system.library.7=com.google.android.gms:play-services-location:15.0.1
cordova.system.library.8=com.android.support:support-core-utils:26.1.0
cordova.system.library.9=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.gradle.include.2=cordova-android-support-gradle-release/pasma-cordova-android-support-gradle-release.gradle
I hope this helps someone. Was a real problem for me.
For me : My external library was using this attributes attr/fontVariationSettings and attr/ttcIndex so I downgrade my library version and sync project . everything fine
So now :
compileSdkVersion 27
implementation 'com.android.support:appcompat-v7:27.1.1'
and for future readers that library was google's easypermission.
implementation 'pub.devrel:easypermissions:2.0.0'
This lib is using sdkversion 28, I have to downgrade to 1.3.0
I have soled the problem by changing target android version to 28 in project.properties (target=android-28) and installed cordova-plugin-androidx and cordova-plugin-androidx-adapter.
I just got this AndroidX error again after I fixed it a year ago. I am using Flutter.
I was able to make releases using Flutter 1.7.8+hotfix.4, then recently I updated Flutter to version 1.17.4 and then I could not compile a release build any more. Debug builds worked just fine.
TLDR:
This time it was a package using another package that was not updated proper for AndroidX
Make sure to update your packages! :)
Error message: Important part
[+1099 ms] > Task :package_info:verifyReleaseResources FAILED
[ +10 ms] FAILURE: Build failed with an exception.
[ +10 ms] * What went wrong:
[ +29 ms] Execution failed for task ':package_info:verifyReleaseResources'.
[ +3 ms] java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
[ +7 ms] ...\build\package_info\intermediates\res\merged\release\values\values.xml:171:error: resource android:attr/fontVariationSettings not found.
[ +2 ms] ...\build\package_info\intermediates\res\merged\release\values\values.xml:172:error: resource android:attr/ttcIndex not found.
[ +1 ms] error: failed linking references.
Error message: Distraction
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'barcode_scan'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
"fontVariationSettings not found". is an AndroidX error, which requires you to use compileSdkVersion 28, but I already had that, so I suspect something was implemented between my two Flutter versions to be more restrictive.
So I had to go hunting and updated packages and found that.
"package_info: ^0.3.2" needed to be "package_info: ^0.4.0" to make it work.
To make it "more" future proof write it like this:
package_info: '>=0.4.0 <2.0.0'
After updating packages my code base compiles for release again.
Hope it helps.
I removed all the unused plugins in the pubspec.yaml and in the External Libraries to solve the problem.
My case was really different. I had set android:text=" ??? " property of my TetxtView in my layout file, when I changed it to android:text=" ? " it worked. I have no idea why this works, maybe it helps someone. It took me hours to find the issue.
I had the same issue and I installed this cordova plugin and problem solved.
cordova plugin add cordova-android-support-gradle-release --save
Related
I have a relatively new project that I'm trying to build. Gradle syncs fine, but whenever I try to build, I get an error like this:
Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Failed to transform artifact 'common.jar (com.android.tools:common:26.4.0)' to match attributes {artifactType=android-classes, org.gradle.usage=java-runtime-jars}.
> Execution failed for JetifyTransform: C:\Users\Dave\.gradle\caches\modules-2\files-2.1\com.android.tools\common\26.4.0\539939e284fba9fe343b890a6e21c9333767c886\common-26.4.0.jar.
> Failed to transform 'C:\Users\Dave\.gradle\caches\modules-2\files-2.1\com.android.tools\common\26.4.0\539939e284fba9fe343b890a6e21c9333767c886\common-26.4.0.jar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.design.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
> Failed to transform artifact 'bundletool.jar (com.android.tools.build:bundletool:0.7.2)' to match attributes {artifactType=android-classes, org.gradle.usage=java-runtime-jars}.
> Execution failed for JetifyTransform: C:\Users\Dave\.gradle\caches\modules-2\files-2.1\com.android.tools.build\bundletool\0.7.2\31f71b66edcbe41de0268e14c961a7799a03d42a\bundletool-0.7.2.jar.
> Failed to transform 'C:\Users\Dave\.gradle\caches\modules-2\files-2.1\com.android.tools.build\bundletool\0.7.2\31f71b66edcbe41de0268e14c961a7799a03d42a\bundletool-0.7.2.jar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.design.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
I only started this project a week ago, and have been using the stable branch of Android Studio and using Gradle plugin 3.5. So, anyone have any ideas how to fix this?
What I've tried:
Disabling Jetifier in gradle.properties left me with errors about old and new databinding dependencies.
Rolling back to Gradle plugin 3.4.2 gave the same error as above.
Adding android.jetifier.blacklist = pass to gradle.properties left me with the same errors as above.
Adding android.databinding.enableV2=true to gradle.properties left me with the same errors as above.
Running the "Migrate to AndroidX" refactor in Android Studio actually left me with this weird refactor preview:
Removing apply plugin: 'kotlin-kapt' from my app-level build.gradle left me with the same errors as above.
Cleaning and rebuilding doesn't work.
Invalidating and restarting doesn't work.
EDIT 1: Gradle dependencies, for the curious... I don't think I'm using anything particularly weird here.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//Kotlin stuff
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0"
//Test tools
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//UI
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.activity:activity:1.1.0-alpha03'
//Lifecycle
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-alpha04'
//Moshi for serialization
implementation 'com.squareup.moshi:moshi:1.8.0'
implementation 'com.squareup.moshi:moshi-kotlin:1.8.0'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-moshi:2.6.1'
//Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.9.0'
//Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.1.0'
implementation 'androidx.navigation:navigation-common-ktx:2.1.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'
implementation "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0"
//Diff utils
implementation group: 'io.github.java-diff-utils', name: 'java-diff-utils', version: '4.0'
//Timber for logging
implementation 'com.jakewharton.timber:timber:4.7.1'
}
Edit 2: Copy-pasted my Gradle dependencies into a new empty project and got the same errors. Could it be one of these dependencies?
Edit 3: Commenting out various libraries from my build.gradle (Moshi, Retrofit, Timber, Glide) also had no effect. So, I probably should submit a bug report to Google. Until then, what's the workaround?
Edit 4: With suggestions from the comments, I tried deleting my .gradle folder and rolling back to an earlier version of the Material design library. Both had no effect, but the latter added something interesting to the build log:
> Transform artifact kotlin-build-common.jar (org.jetbrains.kotlin:kotlin-build-common:1.3.20) with DexingNoClasspathTransform
AGPBI: {"kind":"error","text":"Invoke-customs are only supported starting with Android O (--min-api 26)","sources":[{}],"tool":"D8"}
You are not supposed to put the androidx.navigation:navigation-safe-args-gradle-plugin in your app level build.gradle. That needed to be removed.
Invoke-customs are only supported starting with Android O (--min-api 26).
This means, you'd need at least:
compileSdkVersion 26
targetSdkVersion 26
In my case i updated android studio, automatically it updated my gradle version and the build faled, returning the old version solved the problema.
My android app Gradle build is not syncing, since I updated my android studio to 3.2. I have updated everything in the dependencies and still getting the same error. Here are the dependency files that I use ( Including third-party libraries)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myappid"
minSdkVersion 19
targetSdkVersion 28
versionCode 32
versionName "3.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.11"
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-crash:28.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "org.jetbrains.anko:anko:$anko_version"
implementation 'com.github.GrenderG:Toasty:1.2.5'
implementation 'com.github.scottyab:showhidepasswordedittext:0.8'
implementation 'com.daimajia.easing:library:2.1#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.gms:google-services:4.2.0'
implementation 'com.github.sd6352051:NiftyDialogEffects:v1.0.3'
implementation 'net.steamcrafted:load-toast:1.0.12'
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha1';
}
//apply plugin: 'com.google.gms.google-services'
//classpath 'com.google.gms:google-services:4.2.0'
However, I am getting the following error
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
I have tried most things available through Google/Youtube searches. Implemented few answers given in StackOverflow too. But at the end of the day, it's the same error. What I am missing.
Please advice, how to resolve the issue. Thank you
So the problem doesn't necessarily needs to be in your application level build.gradle script (the one you posted). It can also be in the project level one or even in the maven-publish-aar.gradle one (if you have it). This means, you could be using deprecated Gradle features on any Gradle script.
I have updated everything in the dependencies and still getting the same error.
Most likely, the warning will be gone once you identify and replace any deprecated Gradle feature that's causing you this trouble. To do this, it will help you to actually add the mentioned --warning-mode=all flag to your Gradle command line options (on your Android studio compiler settings):
This will print the proper warnings for you to be aware of what are the specific deprecated features your app is using.
In my case (for example), I just added the enableFeaturePreview('STABLE_PUBLISHING') setting on the settings.gradle file and that did the magic (I'm using publishing{}).
Also, I know you asked this near a month ago, but, it might be useful for other people facing the same issue.
Had same issue yesterday extended to the #Hugo Allexis Cardona answer even after replacing deprecated Gradle feature having same issue because Old build folder is remains there so what I did is Remove app/build folder and sync gradle again and it work for me Thanks #Hugo Allexis Cardona
Delete App/Build Folder
The Problem is because of the inconsistency of external dependencies.
The Issue can be Easily Solved by migrating to Yarn Package Manager
Delete Node Modules
Delete Package.json.lock
yarn install
OR
Try Deleting android/app/build folder
The run the project by react-native run-android
I found easiest way to solve this issue. Go to projectName/android directory and in terminal enter the following command
./gradlew clean
And then, go to main project directory by entering following command
cd ..
And then start the project
react-native run-android
In my case
I Followed Hugo's answer
Changed the location of project.
Tried another android device [Build and success install]
Tried on my android device [Build and success install]
My android app Gradle build is not syncing, since I updated my android studio to 3.2. I have updated everything in the dependencies and still getting the same error. Here are the dependency files that I use ( Including third-party libraries)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myappid"
minSdkVersion 19
targetSdkVersion 28
versionCode 32
versionName "3.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.11"
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-crash:28.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "org.jetbrains.anko:anko:$anko_version"
implementation 'com.github.GrenderG:Toasty:1.2.5'
implementation 'com.github.scottyab:showhidepasswordedittext:0.8'
implementation 'com.daimajia.easing:library:2.1#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.gms:google-services:4.2.0'
implementation 'com.github.sd6352051:NiftyDialogEffects:v1.0.3'
implementation 'net.steamcrafted:load-toast:1.0.12'
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha1';
}
//apply plugin: 'com.google.gms.google-services'
//classpath 'com.google.gms:google-services:4.2.0'
However, I am getting the following error
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
I have tried most things available through Google/Youtube searches. Implemented few answers given in StackOverflow too. But at the end of the day, it's the same error. What I am missing.
Please advice, how to resolve the issue. Thank you
So the problem doesn't necessarily needs to be in your application level build.gradle script (the one you posted). It can also be in the project level one or even in the maven-publish-aar.gradle one (if you have it). This means, you could be using deprecated Gradle features on any Gradle script.
I have updated everything in the dependencies and still getting the same error.
Most likely, the warning will be gone once you identify and replace any deprecated Gradle feature that's causing you this trouble. To do this, it will help you to actually add the mentioned --warning-mode=all flag to your Gradle command line options (on your Android studio compiler settings):
This will print the proper warnings for you to be aware of what are the specific deprecated features your app is using.
In my case (for example), I just added the enableFeaturePreview('STABLE_PUBLISHING') setting on the settings.gradle file and that did the magic (I'm using publishing{}).
Also, I know you asked this near a month ago, but, it might be useful for other people facing the same issue.
Had same issue yesterday extended to the #Hugo Allexis Cardona answer even after replacing deprecated Gradle feature having same issue because Old build folder is remains there so what I did is Remove app/build folder and sync gradle again and it work for me Thanks #Hugo Allexis Cardona
Delete App/Build Folder
The Problem is because of the inconsistency of external dependencies.
The Issue can be Easily Solved by migrating to Yarn Package Manager
Delete Node Modules
Delete Package.json.lock
yarn install
OR
Try Deleting android/app/build folder
The run the project by react-native run-android
I found easiest way to solve this issue. Go to projectName/android directory and in terminal enter the following command
./gradlew clean
And then, go to main project directory by entering following command
cd ..
And then start the project
react-native run-android
In my case
I Followed Hugo's answer
Changed the location of project.
Tried another android device [Build and success install]
Tried on my android device [Build and success install]
I'm getting this error executing my Android app (I cleaned it and then built it, but the error is still present)
Sync: OK
Make Project: OK
Clean: OK
Run: Error
Error:Execution failed for task ':app:dexDebug' .com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_25\bin\java.exe'' finished with non-zero exit value 2
My gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.rzr.rzevallosr.miappdepruebas"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// This library handles authentication and authorization
compile 'com.spotify.sdk:spotify-auth:1.0.0-beta9#aar'
// This library handles music playback
compile 'com.spotify.sdk:spotify-player:1.0.0-beta9#aar'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile files('libs/spotify-web-api-android-master-0.1.0.jar')
compile files('libs/okio-1.3.0.jar')
}
EDIT: I didn't see "compile fileTree(dir: 'libs', include: ['*.jar'])" it was compiling twice my libraries, so i just comment:
//compile 'com.squareup.retrofit:retrofit:1.9.0'
//compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
//compile 'com.squareup.okhttp:okhttp:2.2.0'
//compile files('libs/spotify-web-api-android-master-0.1.0.jar')
//compile files('libs/okio-1.3.0.jar')
and it works fine.
This issue is quite possibly due to exceeding the 65K methods dex limit imposed by Android. This problem can be solved either by cleaning the project, and removing some unused libraries and methods from dependencies in build.gradle, OR by adding multidex support.
So, If you have to keep libraries and methods, then you can enable multi dex support by declaring it in the gradle config.
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
You can read more about multidex support and developing apps with more than 65K methods here.
For me the problem was, i had put a unnecessary complie library code in build.gradle
dependencies {
compile 'com.google.android.gms:play-services:7.5.0'
}
which was causing over 65k methods, so removed it,gradle sync, cleaned project, and then ran again and then this error stopped.
I needed just maps and gcm so i put these lines and synced project
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-location:7.5.0'
Hi people i again encountered this problem and this time it was because of changing build tools version and it really required me to enable multidex..so i added these my app's build.gradle file..
defaultConfig {
applicationId "com.am.android"
minSdkVersion 13
targetSdkVersion 23
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "2048M"
jumboMode = true
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.1'
}
And create a class that extends Application class and include this method inside the class..
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
also include in OnCreate method too
#Override
public void onCreate() {
MultiDex.install(this);
super.onCreate();
}
Just in case if someone still struggling with this and have no clue why is this happening and how to fix. In fact this error
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdkx.x.x_xx\bin\java.exe'' finished with non-zero exit value 2
can have many reasons to happen but certainly not something related to your JDK version so don't wast your time in wrong direction.
These are two main reasons for this to happen
You have same library or jar file included several places and some of them conflicting with each other.
You are about to or already exceeded 65k method limit
First case can be fixed as follows:
Find out which dependencies you have included multiple times. In order to do this run following command in android studio terminal
gradlew -q dependencies yourProjectName_usually_app:dependencies --configuration compile
this will return all the dependencies but jar files that you include from lib folder
try to get rid of duplication marked with asterisk (*), this is not always possible but in some cases you still can do it, after this try to exclude modules that are included many times, you can do it like this
compile ('com.facebook.android:facebook-android-sdk:4.0.1'){
exclude module: 'support-v4'
}
For the second case when you exceeding method limit suggestion is to try to minimize it by removing included libraries (note sounds like first solution) if no way to do it add multiDexEnabled true to your defaultConfig
defaultConfig {
...
...
multiDexEnabled true
}
this increases method limit but it is not the best thing to do because of possible performance issues
IMPORTANT adding only multiDexEnabled true to defaultConfig is not enough in fact on all devices running android <5 Lollipop it will result in unexpected behavior and NoClassDefFoundError. how to solve it is described here
I didn't know (by then) that "compile fileTree(dir: 'libs', include: ['*.jar'])" compile all that has jar extension on libs folder, so i just comment (or delete) this lines:
//compile 'com.squareup.retrofit:retrofit:1.9.0'
//compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
//compile 'com.squareup.okhttp:okhttp:2.2.0'
//compile files('libs/spotify-web-api-android-master-0.1.0.jar')
//compile files('libs/okio-1.3.0.jar')
and it works fine. Thanks anyway! My bad.
I had the same issue and I fixed removing the library that were unnecessary
compile fileTree(dir: 'libs', include: ['*.jar'])
I removed that library and I could run the project without any problem.
Mine got solved by enabling multiDex for debug builds.
defaultConfig {
multiDexEnabled true
}
I Reject Embedded JDK ( in 32bit ) because embedded JDK is 64bit
Right click your Project -> Open Module Setting -> SDK Location -> Uncheck Use embedded JDk then set your JDK Path, eg in Ubuntu /usr/lib/jvm/java-8-openjdk-i386
Possible problem: You have exceeded dex 65k methods limit, may be you added some library or several methods before problem occurred?
If You have already updated your SDK and You also using google-play-services then you need to take care of the dependency because there are some kind of conflics with :
Follow the below : compile 'com.google.android.gms:play-services:+' Replace by compile 'com.google.android.gms:play-services:6.5.87'
Note: Here '6.5.87' is the google-play-service version. I hope it will help..
I think it's conflicts of .jar file in your project.
I have removed android-support-v4.jar from libs folder and its working !!!
if your project gives error, check in your build.gradle file
dependencies {
}
In my case, the problem was that the new library (gradle dependency) that I had added was relying on some other dependencies and two of those underlying dependencies were conflicting/clashing with some dependencies of other libraries/dependencies in my build script. Specifically, I added Apache Commons Validator (for email validation), and two of its dependencies (Apache Commons Logging and Apache Commons Collections) were conflicting with those used by Robolectric (because different versions of same libraries were present in my build path). So I excluded those conflicting versions of dependencies (modules) when adding the new dependency (the Validator):
compile ('commons-validator:commons-validator:1.4.1') {
exclude module: 'commons-logging'
exclude module: 'commons-collections'
}
You can see the dependencies of your gradle module(s) (you might have only one module in your project) using the following gradle command (I use the gradle wrapper that gets created for you if you have created your project in Android Studio/Intellij Idea). Run this command in your project's root directory:
./gradlew :YOUR-MODULE-NAME:dependencies
After adding those exclude directives and retrying to run, I got a duplicate file error for NOTICE.txtthat is used by some apache commons libraries like Logging and Collections. I had to exclude that text file when packaging. In my build.gradle, I added:
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE.txt'
}
It turned out that the new library (the Validator) can work with slightly older versions of its dependencies/modules (which are already imported into my build path by another library (Robolectric)). This was the case with this specific library, but other libraries might be using the latest API of the underlying dependencies (in which case you have to try to see if the other libraries that rely on the conflicting module/dependency are able to work with the newer version (by excluding the older version of the module/dependecy under those libraries's entries)).
In my case, I got this error when there are 2 or more libraries conflict (same library but different versions). Check your app build.gradle in dependencies block.
There are two alternatives that'll work for sure:
Clean your project and then build.
If the above method didn't worked, try the next.
Add the following to build.gradle file at app level
defaultConfig {
multiDexEnabled true
}
Updating my Java SDK to the latest version 1.7.0_79 and updating the SDK Location under Project Structure solved the problem for me.
My problem was that apart from having
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'/Library/Java/JavaVirtualMachines/jdk1.X.X_XX.jdk/Contents/Home/bin/java''
finished with non-zero exit value 2
I had this trace as well:
Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/mypackage/ClassX;
The problem was that I was adding the same class in two differents libraries. Removing the class/jar file from one of the libraries, the project run properly
For me i was adding the whole playstore dependencies
compile 'com.google.android.gms:play-services:8.4.0'
But i needed google map only , so i made it more specific and the error was resolved.
compile 'com.google.android.gms:play-services-maps:8.4.0'
in my case problem was build tools version which was 23.0.0 rc3 and i changed to 22.0.1 and my problem fixed.
You may be using a low quality cable/defected cable to connect your device to the PC, I replaced the cable and it worked for me.
This error is because of using more number of libraries.in my case 'compile 'com.google.android.gms:play-services-9.4.0' caused this error.To avoid this error use necessary libraries.for example if you want to use Maps in your app.Then use
compile 'com.google.android.gms:play-services-maps:9.4.0'.while adding google play services dependency specify the needed libraries only.by default it includes all the libraries.
In Your gradle.build file, Use this
"compile fileTree(dir: 'libs', include: ['*.jar'])"
And it works fine.
If you want to see what exactly is causing the error, try building your project via gradle terminal, like this ./gradlew assembleDebug --stacktrace --debug . I've seen the following error in my case com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
This happened when I was trying to entegrate Google Maps to my project. To fix it, I simply checked libraries I was including
compile 'com.google.android.gms:play-services:9.8.0'
I simply changed it to
compile 'com.google.android.gms:play-services-maps:9.8.0'
and problem was gone
I had the same error after converting my project to Kotlin. My problem was that my jre location was changed to an invalid path during the process (I wonder why this could happen... made me waste time). Fixed it by doing this:
File > Project Structure > SDK Location
Unchecked the Use embedded JDK option, which was pointing to an old JDK installation, and selected the correct one:
/home/my_user/jdk1.8.0_101
After changing this, the error disappeared
WORKED FOR ME :)
i upgraded the java to the latest version 8 previously it was 7 and then go to OPEN MODULE SETTING right clicking on project and changed the jdk path to /usr/lib/jvm/java-8-oracle the new java 8 installed. And restart the studio
check in /usr/lib/jvm for java 8 folder name
I am using ubuntu
Error:
Gradle: Execution failed for task ':vertretungsplan:dexDebug'.
> Failed to run command:
P:\Android-Studio\sdk\build-tools\18.0.1\dx.bat --dex --output P:\Projekte\VertretungsplanProject\vertretungsplan\build\libs\vertretungsplan-debug.dex P:\Projekte\VertretungsplanProject\vertretungsplan\build\classes\debug P:\Projekte\VertretungsplanProject\vertretungsplan\build\dependency-cache\debug P:\Android-Studio\sdk\extras\android\m2repository\com\android\support\support-v4\18.0.0\support-v4-18.0.0.jar P:\Projekte\VertretungsplanProject\vertretungsplan\libs\commons-io-2.4.jar P:\Projekte\VertretungsplanProject\vertretungsplan\build\exploded-bundles\VertretungsplanProjectLibrariesActionbarsherlockUnspecified.aar\classes.jar
Error Code:
2
Output:
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing de/MayerhoferSimon/Vertretungsplan/LoginActivity$2.class
...while processing de/MayerhoferSimon/Vertretungsplan/LoginActivity$2.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing de/MayerhoferSimon/Vertretungsplan/MainActivity$1.class
...while processing de/MayerhoferSimon/Vertretungsplan/MainActivity$1.class
trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing de/MayerhoferSimon/Vertretungsplan/YQL/YqlVplanParser.class
...while processing de/MayerhoferSimon/Vertretungsplan/YQL/YqlVplanParser.class
3 warnings
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:592)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:550)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:531)
at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:186)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:300)
at com.android.dx.command.dexer.Main.run(Main.java:232)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
Project structure:
build.gradle (actionbarsherlock)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
android {
compileSdkVersion 18
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 11
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
build.gradle (vertretungsplan)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/commons-io-2.4.jar')
compile project(':libraries:actionbarsherlock')
}
android {
compileSdkVersion 18
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 11
}
}
settings.gradle
include ':vertretungsplan', ':libraries:actionbarsherlock'
How can I fix this error?
The right answer is, that some of your jar files does not compile.
You should go into your build.gradle file in your project, and look in your dependencies.
If you're just importing some jar files, you could try to remove them and add them one at a time. This will help you determine which one of them causes the error.
In my case, I did just that, and when I was importing the last one, the app compiled. So I think the real problem was that I was importing too many at once. But now it all works.
I suddenly had the same problem, after no noteworthy changes.
I solved it by deleting the app/build directory and let gradle build the whole project new.
You must check if the same JAR is being imported again. In my case there was a class inside a jar which was getting imported in another jar. So just check if the any lib / class file is being included twice in the whole project!
I got the same sort of error when I tried to compile a utils library jar in eclipse using Java JRE 1.8, and use it in my /libs/ in Android Studio 1.1.0.
I had my Android Studio set to use JDK1.8.0.
I switched my Eclipse to work with JRE 1.7, and the error was fixed.
Eclipse: Window->Preferences->Java tab->Compiler -> Compliance level 1.7. It will most likely prompt you to switch your JRE System Library to jdk1.7.x_x.
You may need to make sure to uncheck 'compress jar' when you export. I haven't tested whether it had an effect or not. I doubt it was related.
I had the same problem too.
In my case the problem started after a reboot.
I closed my App, then I closed the Android Studio (In my case V1.1.0), and finally a normal shutdown. After that, I modified one java file to add a RadioGroup object and then the problem appeared.
I solved my problem only changing a simple '0' for a '1' in my Gradle configuration file, because the root cause of the problem was generated at the Gradle execution process. Previously I used to have version '1.0.0' then i changed it to '1.1.0', as stated in the pictures.
Location of the Gradle configuration a changed
Location where I took the right version from (File -> Settings -> Gradle -> Experimental
The problem is NOT about Execution failed for task ':dexDebug'
if you look above the error showed in red you are going to see this
To solve this problem permanently just add these lines in your build.gradle file
android {
dexOptions {
jumboMode = true
}
}
For further details check this question: here
Make sure your AndroidManifest file contains a package name in the manifest node.
Setting a package name fixed this problem for me.
ANDROID STUDIO Users try this:-
You need to add the following to your gradle file dependencies:
compile 'com.android.support:multidex:1.0.0'
And then add below line ( multidex support application ) to your manifest's application tag:
android:name="android.support.multidex.MultiDexApplication"
Could fix this by adding
compile 'com.android.support:support-v4:18.0.0'
to the dependencies in the vertretungsplan build.gradle, compile and then remove this line and compile again.
now it works
I had the same problem, you should do:
File -> Invalidate Caches / Restart
I had this problem because I tried to use both support library and appcompat:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
}
After I deleted support library and changed to older version, it compiled:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
/*compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'*/
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.google.android.gms:play-services:8.3.0'
}
I had two incompatible dependencies.
The below dependencies caused the error.
compile 'com.google.android.gms:play-services-fitness:8.3.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
By changing the fitness dependency to version 8.4.0 I was able to run the app.
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
I found a very interesting issue with Android Studio and the mircrosoft upgrade to the web browser. I upgraded "stupidly" to the latest version of ie. of course Microsoft in their infinite wisdom knows exactly what to do with security. When I tried to compile my app I kept getting the error Gradle - build fails -- Execution failed for task. looking in the stack I saw that it did not recognize the path to java.exe. I found that odd as I was just able to compile the day before. I added JAVA_HOME to the env vars for the system, closed Android Studio and reopened it. Low and behold if the fire wall nag screen did not pop asking if I wanted to all jave.exe through.
What a cluster!
(This might be the wrong thread, as your problem seems more specific, but it's the thread that I found when searching for the issue's keywords)
Despite all good hints, the only thing that helped me, and that I'd like to share just in case, if everything else does not work :
Remove your .gradle directory in your home directory and have it re-build/re-downloaded for you by Android Studio.
Fixed all kinds of weird errors for me that neither were fixable by re-installing Android Studio itself nor the SDK.
A reason can be duplicated libraries after importing from Eclipse IDE.
dependencies {
compile 'com.github.japgolly.android:svg-android:2.0.5'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/androidannotations-api-2.7.1.jar')
compile files('libs/androidasync-2.1.2.jar')
//compile files('libs/google-play-services.jar')
compile files('libs/universal-image-loader-1.8.2.jar')}
I had the same problem, after comment:
//compile files('libs/google-play-services.jar')
The app get no errors.
I faced the same issue .Resolved by doing this .
Go to actionbarsherlock -> module settings ->dependencies .Remove the support v4 library .In bottom left there is a plus button , from there add 1 Library Dependency (Select support-v4) .
Let the gradle resync and clean project once done .
Many of the answers here are trial and error to find duplicate dependencies but if you scroll up just a little bit from the Execution failed for task ':app:dexDebug'. line it will give you a hint at the duplications
.
In my case I had the following error:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define L/com/parse/AbstractQueryController$1;
...
...
...
Execution failed for task ':app:dexDebug'.
So I knew that in order to fix this bug I needed to find the duplicate dependencies that define parse.AbstractQueryController
In my case I had two imported modules that were loading in two different Parse libraries. Making my project only load one fixed my issue.
I have also ran into this error when the package in one of my class files was incorrectly spelled. Many of these answers immediately jump to the Jar files but I would also check to make sure your packages are spelled correctly.
just add in build.gradle
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.11.0'
and sync Project with Gradle Files
But Don't Add The parse Jar in libs :) OKK
If you are also using Dagger or Butterknife you should to add guava as a dependency to your build.gradle main file like classpath :
com.google.guava:guava:20.0
In other hand, if you are having problems with larger heap for the Gradle daemon you can increase adding to your radle file:
dexOptions {
javaMaxHeapSize "4g"
}
In my case, I did Build > Clean Project and it worked!
Cleaning the Project using Build in Menu Bar work for many error scenarios in Android Studio and so it does in this case.