I am getting error while adding dependency for firebase-ui-storage.
I have created app for Kotlin
build.gradle - before:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-storage:10.2.6'
compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
after adding:
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
I am getting error like:
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.1.1. Examples include
com.android.support:animated-vector-drawable:25.3.1 and
com.android.support:palette-v7:25.1.1
There are some combinations of libraries, or tools and libraries, that
are incompatible, or can lead to bugs. One such incompatibility is
compiling with a version of the Android support libraries that is not
the latest version (or in particular, a version lower than your
targetSdkVersion.)
I dont know why it happens even I dont have used vector drawable or palette
Any help?
Thanks in advance.
Recently I had the same issue. So I downgraded the versions to these:
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.android.support:design:25.0.0'
compile 'com.google.firebase:firebase-storage:10.2.4'
compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
compile 'com.google.firebase:firebase-storage:10.2.4'
and it worked fine for me.
But if you want to know what's wrong with your current dependencies, probably you should see what your full tree of dependencies is and from there, you will see which one of your libraries is asking for a different version of the Android Support libraries.
Related
Okay guys, hello. I'm new here (this is my first post, so if I have done anything wrong please forgive me and let me know! ). Could you please help me with this problem. I'm really stuck. check the red underlined line on Screenshot below (dependencies) .
Android Error:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-rc01, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-rc01 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1)
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).
Screenshot:
https://imgur.com/a/4C2Sxg3
I have tried the following:
All com.android.support libraries must use the exact same version specification
All com.android.support libraries must use the exact same version specification (mixing version can lead to runtime crashes)
build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-core:16.0.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso core:3.0.2' }
Hey welcome and congrats with a detailed question!
You're using some dependencies and these dependencies might have transitive dependencies as well. This means that you're compiling your code against some API and your dependencies already compiled against some API (and probably different slightly or more). So gradle is confused which version of that dependency to take - yours or the transitive from the third party. If it would be automatic it might lead to a runtime crash when you or your dependency will try to call a method or class that was changed or doesn't exist in one of the versions of that shared dependency.
You can troubleshoot your dependencies with gradle:
./gradlew dependencies
or even better:
./gradlew dependencies | grep <name of the conflicting dependency> -B 20 -A 20
The usual way in the Android world of resolving it is to force a specific version of this dependency (usually the newest):
configurations.all {
resolutionStrategy {
force <exact dependency version>
}
}
Two addition:
this might not work sometimes when the gap between dependency versions is not backwards compatible
there are other ways of forcing, specifying, excluding dependencies
Today, I update my Android studio to 2.3, and I update gradle to 3.4.1. But when I build my project, an error occurred:
This is the error
So I add " buildToolsVersion '25.0.0' "
My project can build successful, but another error occurred. I can't solve it. I hope to get some help. Thank you!
This is the error
When I add compile 'com.prolificinteractive:material-calendarview:1.4.2', this error will occur.
This is my androidDependencies
This is probably an issue with Android Studio 2.3. There's a new inspection that checks if all dependencies of com.android.support use the same version number. However, multidex doesn't have a matching version number. You can disable the inspection via the red light bulb icon next to it as a work-around for now
it's an unnecessary warning for the support:multidex, add this:
//noinspection AndroidLintGradleCompatible
compile 'com.android.support:multidex:1.0.1'
I'm also using updated Studio. You should use each library with the same version in order to avoid the Manifest Merger issue. Like this.
// To Support Design, CardView and RecyclerView Library
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:palette-v7:25.2.0'
// To Support MultiDex
compile 'com.android.support:multidex:1.0.1'
Here you will notice that each library have the same version.
Change version of com.android.support:recyclerview-v7 and com.android.support:support-core-utils to 25.2.0 (last version of support library: https://developer.android.com/topic/libraries/support-library/revisions.html)
I want to add a card view so that I want to add dependencies (got from google search) when the time of adding dependencies
compile 'com.android.support:cardview-v7:21.0.+'
I am getting gradle error saying that
This support library should not use a different version (21) than the compileSdkVersion (23) less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)
Change your CardView dependency to:
compile 'com.android.support:cardview-v7:23.1.1'
You cannot have a different compile SDK version to versions of the support library.
You used sdk version 23 for your project, but you use version 21 for cardview. If you compile with cardview-v7:23 there should not be a problem any more. It is also a good idea to update the support libraries, if this does not help.
Edit: As I see the picture you posted, you can see that you use 23.1.1 for the other dependencies, but 21.0.+ for the others. Change 21.0.+ to 23.1.1
compile 'com.android.support:cardview-v7:23.0.1'
About Android support library, since 25.0.1 has some bugs, so I want to use 7.24.1,
here's some of my gradle codes
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
But I find the project still refers the latest version; the version number "v7:24.2.1" does not work.
I want use 7:24.2.1, but when I click any Android support class, such as RecyclerView, it opens source code from sdk\extras\android\m2repository\com\android\support\recyclerview-v7\25.0.0\recyclerview-v7-25.0.0-sources.jar
Clean Project will do the trick. Furthermore consider to change compileSdkVersionto24 and also install Android SDK Build-tools in Android SDK Manager.
As the latest version of the support library according to the support library changelog is v7:25.0.1 and not v7:24.2.1 modify your build.gradle to have v7:25.0.1:
compile "com.android.support:appcompat-v7:25.0.1"
However, if you really need v7:24.2.1 then simply put:
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
You dont have to put the rest. They are already included as stated by cricket_007.
It turns out one of the depencencies include the android suppoert library25.0.0,
I solve it by downgrading the depencency library
I got the below message when I use newest version of com.google.android.gms:play-services-xxx:9.8.00
Error:(32, 28) error: cannot access zzanb
class file for com.google.android.gms.internal.zzanb not found
The error was caused by invoking statement:
FirebaseAuth.getInstance().getCurrentUser().getUid();
How can I fix this problem?
Thank you.
UPDATE: Problem was solved
The newest updated of firebase version 9.8.0 is compatible with the google-service version 9.8.0. Now, everything works correctly.
NOTE: Firebase and Google Play Sevice always have same version. #see Ian Barber's comment below.
9.8.0 was an accidental early release. Please don't use it! If you happened to update your Android tools over the weekend of October 22-23, you may have accidentally received this update. To remove it, simply uninstall and reinstall the Google Repository tool.
I had such a similar error when i was recently upgrading my play service dependency. It seems to occur when you leave out updating the firebase dependencies that correspond to the version of play services you use.
Here is what the two versions of my dependencies were:
Error version of dependencies
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
compile 'com.google.firebase:firebase-storage:9.8.0'
Working version of dependencies
``
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.0'
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
compile 'com.google.firebase:firebase-storage:10.0.0'
``
Google seems to move play service updates along with firebase updates these days. Hopes this saves a few souls out there.
There is a tricky inconsistency in the build.gradle(Module App) warnings that can lead to this error. I had all my play-services compiles:
compile 'com.google.android.gms:play-services-drive:9.6.1'
compile 'com.google.android.gms:play-services-plus:9.6.1'
--- etc ---
grayed out, with a note that a newer version, namely 9.8.0, was available after I upgraded various Google Play apks. After changing all the play-services compiles to 9.8.0:
compile 'com.google.android.gms:play-services-drive:9.8.0'
compile 'com.google.android.gms:play-services-plus:9.8.0'
---etc---
I got the weird error:
class file for com.google.android.gms.internal.zzanb not found
in attempting to compile my code. The tricky thing was all my firebase compiles:
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-invites:9.6.1'
---etc---
were NOT grayed out, so I neglected to upgrade those compiles at the same time as I upgraded the play-services compiles. Upgrading all the firebase compiles to 9.8.0:
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-invites:9.8.0'
--- etc ---
fixed the error.
Also, the warnings in the monitor when you get this error suggest depressing 'deprecation' and 'unchecked' lint warnings. That is unnecessary and doesn't fix it.
Android Studio should gray out both the firebase and play-services compiles together to avoid this error, particularly as the error message is so cryptic and the lint warning suppression suggestions don't work.
Finally, I get back to com.google.android.gms:play-services-xxx:9.6.1.
I guest that the problem occur because of the difference between firebase version and gms version. Currently, Firebase run on version 9.6.1