Android library dependency version conflicts - android

I understand that adding 2 different versions of the support library can cause conflicts which is why I get an error when I add the 2 dependencies compile 'com.android.support:appcompat-v7:25.3.1' and compile "com.android.support:support-core-utils:25.4.0". The thing I don't understand is that when I add the design library to the compile list, compile 'com.android.support:design:25.4.0' , the dependency version conflict resolves when I sync the gradle project.
Shouldn't there still be a conflict between compile 'com.android.support:appcompat-v7:25.3.1' and compile "com.android.support:support-core-utils:25.4.0"?

Related

How to add two version of same dependency

How can I compile the following versions in one android app?
compile 'com.google.protobuf:protobuf-java:3.2.0'
compile 'com.google.protobuf:protobuf-java-util:3.2.0'
compile 'com.google.protobuf:protobuf-java:3.0.0-beta-1'
compile 'com.google.protobuf:protobuf-java-util:3.0.0-beta-1'

Error when adding new dependency to Gradle file?

My build.gradle file:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.github.pwittchen:weathericonview:1.1.0'
compile 'com.jakewharton:butterknife:8.3.0'
compile 'com.android.support:support-v4:23.4.0'
testCompile 'junit:junit:4.12'
apt 'com.jakewharton:butterknife-compiler:8.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'me.everything:overscroll-decor-android:1.0.3'
}
Adding this dependency 'com.github.paolorotolo:appintro:4.1.0' to the gradle file redlines this part 'com.android.support:appcompat-v7:23.4.0' from my gradle file and gives this following error:
All com.android.support libraries must the exact same specification. Found versions 24.2.1, 23.4.0
What does this mean? How do I avoid this conflict when adding that dependency?
It means that the new appintro dependency adds a sub-dependency on the support library, v24.2.1, but you already have an earlier one.
Update your direct dependency to the same version, which in practice will probably be fine, or you'll need to use an older version of appintro that in turn uses an earlier version of the support library.
That is, in the case of the former, change your line to:
com.android.support:appcompat-v7:24.2.1
Edit: I say 'probably fine', because the Android support library is a very stable set of APIs and continues to perform consistently across versions. Outside of that, often when a version change is required, you need to assess whether there are any breaking changes or altered behaviours.

(Failed to resolve , two libararies with same package name) Conflict between gms library and firebase-messaging

Here I want to use two libraries in my gradle files which are not from same package but it doesnt allow me to use it, how can I solve it?
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.android.support:design:22.2.1'
compile files('libs/fortumo-in-app-android-sdk.jar')
compile 'com.google.firebase:firebase-messaging:9.4.0'
Android force you to use the same google version of dependencies if you are using more then one google dependencies.
So i'll suggest you to use the latest dependencies.
compile 'com.google.android.gms:play-services-ads:7.5.0'
Replace above dependency with the below one and you are good to go.
com.google.android.gms:play-services-ads:9.4.0
Problem
Conflicting between two same type com.google library .
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
Call firebase-messaging:9.4.0 instead of play-services-ads:7.5.0
Then Clean-Rebuild-Gradle .Before starting work please read Add Firebase to Your Android Project
I guess you're getting an error, something like this:
All com.google.android.gms libraries must use the exact same version
specification (mixing versions can lead to runtime crashes)
Which is quite self-explanatory.
Change the following:
compile 'com.google.android.gms:play-services-ads:7.5.0'
To this:
compile 'com.google.android.gms:play-services-ads:9.4.0'

Gradle Google Play Services gms module error

I'm trying to build my Android Studio project with gradle. I added a compile rule as follows:
compile 'com.google.android.gms:play-services:6.5.87'
However it gives the following error:
Error:Module version com.google.android.gms:play-services:6.5.87 depends on libraries but is not a library itself
I have tried changing version and excluding support-v4 module, as mentioned here:
Crouton depends on libraries but is not a library itself
But I cannot solve the error.
Any help would be appreciated.
EDIT: Here is my dependency list from my build.gradle file:
dependencies {
// compile project(':library')
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.2'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile('org.apache.httpcomponents:httpmime:4.3.5') {
exclude module: 'org.apache.httpcomponents:httpclient'
}
}

Multi dex files define Lcom/google/gdata/util/common/base/Escaper

Multi dex files define Lcom/google/gdata/util/common/base/Escaper
I am stuck with the above error. The error ocured after i have added a dependency to the UserVoice SDK
compile 'com.uservoice:uservoice-android-sdk:+'
since i added this dependency i am unable to run my Android project.
I have read about the jarjar command could probably solve this issue. But since the dependency are .aar librararies i do not know what could be the possible solution
any help is greatly appreciated
List of other depedencies:
compile('com.crashlytics.sdk.android:crashlytics:2.1.0#aar') {
transitive = true;
}
compile('com.twitter.sdk.android:twitter:1.1.0#aar') {
transitive = true;
}
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'
compile 'com.squareup.retrofit:retrofit:1.7.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.jakewharton:butterknife:5.1.2'
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'com.melnykov:floatingactionbutton:1.0.5'
compile 'com.balysv.materialmenu:material-menu-abc:1.+'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.5#aar'
compile 'com.facebook.android:facebook-android-sdk:3.20.0'
compile 'com.joanzapata.android:android-iconify:1.0.8'
compile 'com.squareup:otto:1.3.5'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:cardview-v7:21.+'
Gradle depdencies pastebin: http://pastebin.com/0m6b8Wyi
The problem you are having is caused by the fact that you have two dependencies that include the Escaper class. These are most likely dependencies of your dependencies so it's not obvious which one includes that class. You can be sure that com.uservoice:uservoice-android-sdk:+ includes the class Escaper as that is when your error occurs.
You can fix this problem by excluding the dependency from one of your compile dependencies. Take a look at the Gradle docs and scroll down to where it talks about "Excluding transitive dependencies". One thing to be careful of is the fact that the dependencies might be different versions but contain the same class. You should confirm that both libraries will work with the same version of the Escaper class.

Categories

Resources