Andriod Studio Gradle - failed to resolve dagger any version over 2.24 - android

Here is the following snippet from the Gradle build file:
implementation "com.google.dagger:dagger:${versions.dagger}"
implementation "com.google.dagger:dagger-android:${versions.dagger}"
implementation "com.google.dagger:dagger-android-support:${versions.dagger}"
kapt "com.google.dagger:dagger-compiler:${versions.dagger}"
kapt "com.google.dagger:dagger-android-processor:${versions.dagger}"
If I set the ${versions.dagger} to anything over 2.24 e.g. 2.25.x the gradle sync fails to resolve.
ERROR: Failed to resolve: com.google.dagger:dagger-android-support:2.25.2
EDIT: I checked the maven repository and the latest version available is 2.25.4
EDIT: Upgrading from 2.24

Related

error in implementing the places api dependancy

implementation 'com.google.android.libraries.places:places:1.0.0'
error as follows:
ERROR: The library com.google.android.gms:play-services-base is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.1.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
Use the latest dependency version.
Edit your app level build.gradle file.
dependencies {
implementation 'com.google.android.libraries.places:places:2.4.0'
}

android-jetifier: "Could not resolve all artifacts"; "Failed to transform artifact" on new project

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.

error: resource android:attr/fontVariationSettings not found

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

Not able to build Android gradle project from command line with dagger 2 dependency

I've bee using dagger for a while and now I'm facing a problem related to the generation of DaggerAppComponent class.
It is working as expected while running the project from Android Studio, but whenever I run the task assembleDebug on command line on the root dir, gradle cannot build the entire project since dagger classes are not being generated.
I am missing some task in order to completly execute the dagger annontation processor?
Dependencies:
final DAGGER_VERSION = '2.0.1'
compile "com.google.dagger:dagger:$DAGGER_VERSION"
annotationProcessor "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
provided 'org.glassfish:javax.annotation:10.0-b28'
This is the final error:
import com.company.injection.DaggerAppComponent;
^
symbol: class DaggerAppComponent
location: package com.company.injection
:mobile:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mobile:compileDebugJavaWithJavac'.
> java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.filterKeys(Lcom/google/common/collect/SetMultimap;Lcom/google/common/base/Predicate;)Lcom/google/co
mmon/collect/SetMultimap;
Just to make sure, the graph is ok and it is working correctly, the problem just happen if I try to build the project by command line with assembleDebug.
After spending some time on this, I fixed the problem adding the guava dependency as the annotationProcessor just above the dagger-compiler.
final DAGGER_VERSION = '2.0.1'
compile "com.google.dagger:dagger:$DAGGER_VERSION"
annotationProcessor 'com.google.guava:guava:19.0'
annotationProcessor "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
provided 'org.glassfish:javax.annotation:10.0-b28'
I had the same config with 'com.google.guava:guava:19.0' but I was having the following error:
Error:Execution failed for task ':mobile:compileDebugJavaWithJavac'.
> java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.filterKeys(Lcom/google/common/collect/SetMultimap;Lcom/google/common/base/Predicate;)Lcom/google/common/collect/SetMultimap;
I tried to update the guava version to the current at the time 'com.google.guava:guava:22.0' but the error continued.
I changed to 'com.google.guava:guava:21.0' and it worked nicely. May be an incompatibility with others versions.

unsupported gradle method instrumentTestCompile

I have an unsupported gradle method instrumentTestCompile when including espresso in my Android project gradle.build on Android studio following Google instructions:
https://code.google.com/p/android-test-kit/wiki/Espresso#Espresso_Setup_Instructions.
gradle.build:
dependencies {
instrumentTestCompile files('libs/espresso-1.1.jar',
'libs/testrunner-1.1.jar',
'libs/testrunner-runtime-1.1.jar')
instrumentTestCompile 'com.google.guava:guava:14.0.1',
'com.squareup.dagger:dagger:1.1.0',
'org.hamcrest:hamcrest-core:1.1',
'org.hamcrest:hamcrest-integration:1.1',
'org.hamcrest:hamcrest-library:1.1'
}
Complete error:
Build script error, unsupported Gradle DSL method found: ‘instrumentTestCompile()’!
Possible causes could be:
– you are using Gradle version where the method is absent
– you didn’t apply Gradle plugin which provides the method
– or there is a mistake in a build script
I found the response here:
http://android.amberfog.com/?p=894
instrumentTestCompile() was renamed to androidTestCompile() in the latest version of gradle plugin.

Categories

Resources