Error when adding new dependency to Gradle file? - android

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.

Related

Android library dependency version conflicts

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"?

(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'

Compiling com.parse:parsefacebookutils leads to com.parse.Parse Class not found exception

I'm currently trying to add Facebooklogin capabilites to my App.
According to the Android Docs, when I add
compile 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
To my Build.gradle it should include the entire com.parse.Parse, com.parse.ParseObject... classes already. So I removed the compile for the normale parse-android and now my dependencies look like that:
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
//compile 'com.parse:parse-android:1.10.3' //Already include in parsefacebookutils
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
//NOTE: I do not actually have anything in my 'libs' folder.
BUT after doing so my Applicationclass (and every other Class) can't find the com.parse.Parse stuff. And the com.parse namespace only contains the 'ParseFacebookUtils' class.
I already tried:
compiling the 'com.parse:parse-android:1.10.3' in the dependencies, which only leads to the expected 'DexError' when deploying.
Removing the #aar at the end, which imported the com.parse namespace correctly, but lead to the Gradle error. I assume because the facebookutils have the parse-android:1.10.3 as dependency in their maven project. (http://mvnrepository.com/artifact/com.parse/parsefacebookutils-v4-android/1.10.3)
Warning:Module 'com.parse:parsefacebookutils-v4-android:1.10.3' depends on one or more Android Libraries but is a jar
sounds like there is a bug in the parsefacebookutils that is loaded. I can't say what it is but work around is that download the latest jar files and use them instead of loading.
Parse-1.11.0
ParseFacebookUtilsV4-1.10.3
those .jar files in library directory and remove the compile rows from build.gradle.
at least I'm getting forward with this.

finished with non-zero exit value error

I've tried any solution suggested trying to solved the aapt.exe error.
every time I'm trying to add a new dependency to the build.gradle I get this error and after removing the dependency the error disappear.
I've tried chnging the compile SDK, changing the build tools version, invalidate/clear cache, activating compile independent modules in parallel.
The only dependencies registered are:
signingConfigs { compile fileTree(include: '*.jar', dir: 'libs')
compile project(':android-support-v7-appcompat')
compile files('libs/android-integration-3.2.1.jar')
compile files('libs/android-core-3.2.1.jar')
How can I handle it if I need to add another dependency to my project?
I'm working on android studio 1.4.1
compileSdkVersion 19
buildToolsVersion '22.0.1'
you should be adding your dependency libraries in build.gradle in (Module:app), if you are adding any library using Android studio GUI it will end up adding that library in this place or if you manually place a library in libs and add it to project as library it will still be added here.
Kindly check where and how are you adding your dependency
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.google.code.gson:gson:2.4'
compile files('libs/commons-io-2.4.jar')
}
in above code gson library is added compile 'com.google.code.gson:gson:2.4' is added using android studio GUI and
apache common io is added compile files('libs/commons-io-2.4.jar')
by placing it's library in libs directory in the Android project

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