Gradle com.android.support and com.google.android.gms library conflict - android

I'm working on a Firebase chat app inside my main project and I added Firebase dependencies to my build.gradle, but then I got this message after sync:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes.) Found versions 25.3.1, 25.0.0, 23.4.0. Examples include com.android.support:animated-vector-drawable:25.3.1 and com.android.support:palette-v7:25.0.0
on
compile 'com.android.support:appcompat-v7:25.3.1'
and
All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes.) Found versions 9.8.0, 10.2.6. Example include com.google.android.gms:play-services-auth-base:9.8.0 and com.google.android.gms:play-services-ads-lite:10.2.6
on
compile 'com.google.android.gms:play-services-ads:10.2.6'
Here is my dependencies in build.gradle (Module:app):
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 files('lib/mysql-connector-java-5.1.6.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:10.2.6'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
//Chat dependencies
compile 'com.android.support:design:25.3.1'
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.github.hani-momanii:SuperNova-Emoji:1.0'
}

according to your build.gradle file,
duplicate line of code found
compile 'com.android.support:design:25.3.1'
remove one and try .

Related

Google Play services Version Issue with adobe creative sdk library android

I am using adobe creative sdk library in my photo editing application. When I add dependencies of this library in my application, it adds its necessary libraries in my project. It adds google play services base library version 9.4.0 which is not the latest version.So, problem is that when I add a google ads dependency in my project, it shows error as below:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.8.0.
So how can I update the play services base library version? it is not showing in my Gradle file but its showing in my external libraries of the project as shown below.
Build.gradle dependencies:
implementation 'com.google.firebase:firebase-core:11.8.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
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'
})
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
testCompile 'junit:junit:4.12'
/* Add the CSDK framework dependencies (Make sure these version numbers are correct) */
// compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.3'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
compile 'com.adobe.creativesdk:image:4.8.4'
compile 'com.localytics.android:library:4.0.1'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.intuit.sdp:sdp-android:1.0.4'
compile 'com.github.bumptech.glide:glide:4.3.1'
compile 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.android.support:support-v4:25.4.0'
External Libraries Directory

Java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class

Why am getting this error it will not occurred when I sync the Gradle but when I'm running the project I am getting this error .
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/common/base/FinalizableReference.class
I don't know which dependency cause this error, My dependencies are .
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 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:customtabs:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:percent:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.19.0'
compile 'com.google.android.gms:play-services-auth:11.0.0'
compile 'com.google.android.gms:play-services-location:11.0.0'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services-places:11.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'io.nlopez.smartlocation:library:3.3.1'
compile 'com.appeaser.sublimenavigationviewlibrary:sublimenavigationviewlibrary:0.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.afollestad:sectioned-recyclerview:0.4.1'
compile 'com.github.medyo:fancybuttons:1.8.3'
compile 'com.basgeekball:awesome-validation:2.0'
compile 'com.github.michaelye.easydialog:easydialog:1.4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Edit
I figured it out play service dependencies causing this problem. when I'm using 10.2.6 instead of 11.0.0 app is working perfectly, I just change dependecies to
compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-places:10.2.6'
but I want to use latest version of play-services 11.0.0 but it gives me the above problem. How to resolve this problem? Any help would be appriciated Thanks.
Finally problem is solved. Seems like its a bug google resolved this issue in updated version.
Use play Service Version 11.0.1
In project level gradle use
classpath 'com.google.gms:google-services:3.1.0'
Sometimes, this issue happens because of including different version of play-services (or some other libraries). Have a look at app dependencies using below:
gradle app:dependencies
or if you are using Gradle wrapper
./gradlew app:dependencies
There might be some other third party library that is using an older version of library. If that is the case, exclude the older library from the third party library and include the latest one.
You can do something like this:
compile ('com.thirdpartylib.android:library-sdk:8.3.0') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
compile 'com.android.support:support-v4:26.0.0'
compile 'com.android.support:support-annotations:26.0.0'
compile 'com.google.android.gms:play-services-gcm:11.2.0'
}
This should resolve any duplicate entry, the main reason for the issue

All support libraries must use the exact same version specification

I getting alll support libraries must use the same exact version.
but I'm using the same version.
The error i'm getting.
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 24.2.1, 23.0.1. Examples include com.android.support:animated-vector-drawable:24.2.1 and com.android.support:cardview-v7:23.0.1 less...
My Build.gradle file
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:animated-vector-drawable:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile files('libs/zxing-2.1.jar')
compile files('libs/ksoap2-android-assembly-2.5.7-jar-with-dependencies.jar')
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
//Citrus
compile 'com.citruspay.sdk:payment-sdk:4.1.3'
compile 'com.journeyapps:zxing-android-embedded:3.4.0'
compile 'me.dm7.barcodescanner:zbar:1.8.2'
compile project(':qrpaylib')
}
can you help me in this scenario?

getAdapterPosition() is not found as a method

I recently uprated to Android Studio 2.3 and not the getAdapterPosition (RecyclerView) cannot be found. I saw on the web that the reason for that is the support library version. But I am not sure how to solve it still. My support:appcompat-v7:25.2.0' version is the latest possible (e.g. above 21). I don't understand why the method is not found. Any advice, please?
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 files('libs/wekaSTRIPPED.jar')
compile('com.mikepenz:materialdrawer:5.8.1#aar') { // Material Drawer
transitive = true
}
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.google.dagger:dagger:2.9'
compile 'com.github.wendykierp:JTransforms:3.1'
compile 'com.afollestad.material-dialogs:commons:0.9.3.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.borax12.materialdaterangepicker:library:1.9'
compile 'com.evernote:android-job:1.1.7' // Scheduling library
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
Can you please check you are using this method in ViewHolder Class?
getAdapterPostion() is the method of RecyclerView.ViewHolder.
You need to make sure you are using this method inside the class extending RecyclerView.ViewHolder
compile 'com.android.support:recyclerview-v7:25.2.0'
may be missing that line ???
Please add this dependency:
compile 'com.android.support:recyclerview-v7:23.3.0'
Probably you have to use buildToolsVersion 25.2.0 too, and in my case the gradle showed me and error:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 25.2.0, 25.0.0. Examples include
com.android.support:animated-vector-drawable:25.2.0 and
com.android.support:customtabs:25.0.0
To solve this I have had to add this line compile 'com.android.support:customtabs:25.2.0' forcing to use this version for customtabs.
Before:
// android support
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
After:
// android support
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
If you have an error like this, I recommend you to add the library that shows the error with the version you want.

In Android Studio, all com.android.support libraries must use the exact same version

I recently upgraded to Android Studio 2.3. and this error started appearing:
Here is my list of libraries:
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 files('libs/wekaSTRIPPED.jar')
compile('com.mikepenz:materialdrawer:5.8.1#aar') { // Material Drawer
transitive = true
}
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.google.dagger:dagger:2.9'
compile 'com.github.wendykierp:JTransforms:3.1'
compile 'com.afollestad.material-dialogs:commons:0.9.3.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.borax12.materialdaterangepicker:library:1.9'
compile 'com.evernote:android-job:1.1.7' // Scheduling library
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
Any idea on how to solve this?
I had the problem like you when updating to Android Studio 2.3. I solved by I searched in my project all support library using 25.1.1 (I searched 25.1.1) and replace with 25.2.0. I think many code using 25.1.1, in your library and your project.
You can open external lib in your project to show all dependency. You should update to new library version(lib using support library):
For ex:
https://github.com/mikepenz/MaterialDrawer - new version is 5.8.2 using 25.2.0

Categories

Resources