When I start my flutter app, Im getting this error:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.0.
2]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
My dependencies in build gradle:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-basement:17.4.0'
implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
implementation 'com.google.firebase:firebase-perf:19.0.10'
implementation 'com.google.firebase:firebase-database'
}
apply plugin: 'com.google.gms.google-services'
Please help me) Thanks in advance
To prevent versioning conflicts between Firebase SDKs, I recommend using the Firebase Bill of Materials (BoM) to manage the versions.
With the BoM, you'd have the following dependencies for Firebase:
dependencies {
implementation platform('com.google.firebase:firebase-bom:26.2.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-perf'
implementation 'com.google.firebase:firebase-database'
}
So as you can see, the only version we specify is for the Bill of Materials itself This in turn then specifies the (compatible) versions of the specific product SDKs.
Related
Tried to add Firebase UI implementation
implementation 'com.firebaseui:firebase-ui-database:6.2.0'
in build.gradle file.
The following error was shown.
*ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.firebaseui:firebase-ui-database:6.2.0.
Affected Modules: app*
Please guide me how to resolve the issue.
I am using Android Studio 3.5.3
Other dependencies I have already implemented in the app
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
You need to update the following dependencies:
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
to
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0
Also upgrade to androidX. Check the following for more information:
From the docs:
FirebaseUI version 6.0.0 has no breaking API changes from version 5.1.0 but updates critical dependencies to new major versions.
There are two major groups of changes:
Convert all Android Support Library dependencies to AndroidX or Jetpack dependencies. For information on migrating to AndroidX see this guide.
Update all Firebase and Google Play services dependencies to their latest major versions. For information on changes included in these SDKs visit the release notes.
You can follow these steps:
Press F4 to open Module settings
Select Dependency
Click Add new dependency
Type firebase, search for firebase.ui and add its latest dependency.
At last I was able to sync successfully without Error.
The final dependencies in the build.gradle file of the app.
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.firebaseui:firebase-ui-database:6.2.0'
My gradle file is not throwing any error while building. But, when I run Android lint, it fails with incompatible gradle version error.
Sharing the error:
Incompatible Gradle Versions
../../build.gradle: All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 16.0.2, 16.0.1, 16.0.0, 15.1.0, 15.0.1. Examples include com.google.android.gms:play-services-measurement-base:16.0.2 and com.google.android.gms:play-services-measurement-api:16.0.1**
Sharing the google dependencies defined in app level gradle:
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:gridlayout-v7:27.1.1'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.android.support:preference-v14:27.1.1'
compile 'com.android.support:support-annotations:27.1.1'
compile 'com.android.support.constraint:constraint-layout:1.1.3'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-analytics:16.0.0'
compile 'com.google.android.gms:play-services-auth:16.0.0'
compile 'com.google.firebase:firebase-core:16.0.3'
compile 'com.google.firebase:firebase-messaging:17.3.0'
compile 'com.google.code.gson:gson:2.8.2'
Project level gradle file:
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:1.5.0'
Which dependency making this lint error? How to solve this gradle incompatibility issue?
I have tried changing all google gms versions to 15, but it didn't solved the issue..
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-analytics:15.0.2'
compile 'com.google.android.gms:play-services-auth:15.0.1'
It happens because you are using an old plugin
classpath 'com.google.gms:google-services:1.5.0'
and different versions of the Google Services libraries.
You should update the Google Services Gradle Plugin:
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
// ...
}
Then update your dependencies but it not necessary to use the same version.
Starting from plugin 3.3.0 there is a different behaviour:
Google Play services libraries after 15.0.0 now have independent
version numbers which follow SemVer. This change will allow for more
frequent, flexible updates by individual components. The Google
Services Gradle plugin has been updated to version 3.3.0 to support
this change in versioning.
Check also the documentation:
REMOVE THIS OLD PATTERN:
buildscript {
ext {
play_version = '15.0.0'
}
}
dependencies {
// DON’T DO THIS!!
// The following use of the above buildscript property is no longer valid.
implementation "com.google.android.gms:play-services-ads:${play_version}"
implementation "com.google.android.gms:play-services-auth:${play_version}"
implementation "com.google.firebase:firebase-firestore:${play_version}"
}
Now each dependency that you use may now be at different versions.
You need to update gradle build tools to this version:-
classpath 'com.android.tools.build:gradle:3.2.1'
and google play services
classpath 'com.google.gms:google-services:3.2.0'
The error message
All com.google.android.gms libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 16.0.2, 16.0.1, 16.0.0, 15.1.0, 15.0.1.
is very clearly telling that
This is what you have right now:
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-analytics:16.0.0'
it must be:
compile 'com.google.android.gms:play-services-location:16.0.2'
compile 'com.google.android.gms:play-services-maps:16.0.2'
compile 'com.google.android.gms:play-services-analytics:16.0.2'
Also, try to always use the latest version of Google APIs.
Hope this will help you.
adding to #Nouman Ch answer , These are the latest dependencies
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.6'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
check here and here for finding latest versions
Go to project view of android studio. There in .idea> libraries you'll find libraries with versions 16.0.2, 16.0.1, 16.0.0, 15.1.0, 15.0.1.
These libraries are imported as dependencies of the ones you have in your build.gradle file. Import the latest versions of those libraries in your dependencies to remove the error.
I am getting this error when updating the Firebase libraries:
The library com.google.firebase:firebase-analytics is being requested
by various other libraries at [[15.0.1,16.0.0), [16.0.1,16.0.1],
[16.0.1,99999]], but resolves to 16.0.1. Disable the plugin and check
your dependencies tree using ./gradlew :app:dependencies.
Dependencies are:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-invites:16.0.1'
implementation 'com.google.firebase:firebase-config:16.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.2'
Is there a simple way to find the correct configuration?
If not, what plugin is to be disabled and how? if i just run the task i get the same error.
Update:
i think this dependency has something to do it with, because if disable it's pluging the depedency task runs:
implementation 'com.google.android.gms:play-services-auth:15.0.1'
Try using these steps:
Update your implementation versions (for the newest firebase versions see the release notes https://firebase.google.com/support/release-notes/android)
Update your project build.gradle file with the newest google-services version (at the moment classpath 'com.google.gms:google-services:4.0.1)
Or see this similar post
Where's the conflict, how to fix it, and to find in the future the source of conflict?
What went wrong: 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 16.0.0.
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 17
targetSdkVersion 27
}
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.maps.android:android-maps-utils:0.4.3'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-crash:16.0.0'
apply plugin: 'com.google.gms.google-services'
One of your dependency is having different version of com.google.android.gms.
I inspected com.google.maps.android:android-maps-utils:0.4.3 from github page. I found that it is using very old version of maps, see on above page.
dependencies {
compile 'com.google.android.gms:play-services-maps:11.0.4'
}
As solution you can
Either downgrade your play-service dependency versions as same as maps-utils
Or you can upgrade this dependency gms version by downloading from github page, and add as module in your project.
Keep in mind if you use latest version of gms dependencies in your app, then use latest google-services in project level build.gradle. Like
classpath 'com.google.gms:google-services:3.3.0'
Edit
Use this config to downgrade your version of gms and firebase.
def GMS_VERSION = "11.0.4"
def FCM_VERSION = "11.0.4"
dependencies {
// ...
implementation "com.google.android.gms:play-services-analytics:$GMS_VERSION"
implementation "com.google.android.gms:play-services-location:$GMS_VERSION"
implementation "com.google.android.gms:play-services-maps:$GMS_VERSION"
implementation "com.google.android.gms:play-services-places:$GMS_VERSION"
implementation 'com.google.maps.android:android-maps-utils:0.4.3'
implementation "com.google.firebase:firebase-messaging:$FCM_VERSION"
implementation "com.google.firebase:firebase-crash:$FCM_VERSION"
}
One of your dependency is having different version of com.google.android.gms.
exactly. At Google, they seem to fix it like (old note):
configurations.all {
resolutionStrategy.force "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
}
So find out the common/latest used version, and then use resolutionStrategy.force.
Situation
Today, after touching nothing of the project, my gradle yelled at me and wouldn't compile the project. It failed to resolve firebase-iid, firebase-common, play-services-analytics-impl, play-services-auth-api-phone, and play-services-auth-base. So quite a mess after the weekend.
So I checked the versions of the different APIs, and upgraded the ones that needed upgrading, found out that Google had added a mandatory dependency to firebase-core, added it, then upgraded my google-services plugin, and even added a play-services-base dependency. I also upgraded firebase-messaging to version 17.0.0, and crashlytics to version 2.9.3.
But still, the build doesn't compile, with this error message:
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.2,15.0.2], [15.0.4,15.0.4]], but resolves to 15.0.4. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
Gradle Files
Here is my Gradle file (showing dependencies part only), after my attempted fixes:
apply plugin: 'com.android.application'
...
dependencies {
implementation project(':library')
implementation project(':otherlibrary')
implementation 'com.android.volley:volley:1.1.0'
implementation('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:15.0.2'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation('com.google.android.gms:play-services-ads:15.0.1') {
exclude group: 'com.android.support', module: 'customtabs'
}
implementation 'com.google.android.gms:play-services-identity:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-drive:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.slider:library:1.1.5#aar'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:exifinterface:27.1.1'
implementation 'com.android.support:support-v13:27.1.1'
// https://mvnrepository.com/artifact/com.darwinsys/hirondelle-date4j
implementation group: 'com.darwinsys', name: 'hirondelle-date4j', version: '1.5.1'
// For RxAndroid and RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 2.x.x version)
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
// Crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
// CSV with outputstream writer
implementation 'com.opencsv:opencsv:4.1'
// Gson
implementation 'com.google.code.gson:gson:2.8.5'
debugImplementation 'com.android.support.test:runner:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
androidTestImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And my project-wide gradle contain these lines:
...
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
...
}
dependencies {
...
classpath 'com.google.gms:google-services:4.0.1'
}
...
Official solution doesn't work
I already tried to fix the version number of multiple libraries according to the official firebase documentation, which is more or less the same as this question.
As you can read in the official documentation link, as of May 2nd, 2018, they offered a way to fix this kind of issue, but the numbers of the versions in question are not the same, and I already tried the given fix (with some downgrades now), to no avail.
Official documentation:
If your app has a dependency on com.google.firebase:firebase-core:15.0.0 as well as any of the following libraries:
com.google.android.gms:play-services-analytics
com.google.android.gms:play-services-appinvite
com.google.android.gms:play-services-tagmanager
com.google.firebase:firebase-analytics
com.google.firebase:firebase-crash
com.google.firebase:firebase-dynamic-links
com.google.firebase:firebase-messaging
You will need to update the version of the latter dependency to
15.0.2. This addresses the issue where version 3.3.0 of the Google Services Gradle plugin reports: The library
com.google.android.gms:play-services-measurement-base is being
requested by various other libraries at [[15.0.0,15.0.0],
[15.0.2,15.0.2]], but resolves to 15.0.2...
So how can I resolve these conflicts of versions in order for my build to compile once again correctly?
So after a day lost in this issue, I found out that the latest version of play-services-analytics is not the one they have published in their website. It is 16.0.0 and not 15.0.2.
Android Studio told that to a colleague as a warning, but mine was unconcerned about it. So here it is, the line that changes everything:
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
I added this to my build.gradle (application version) and it worked:
googleServices { disableVersionCheck = true }
(Keep in mind that this is just to disable the version check, it does not actually fix anything)
I tried reverting back to an old build, and it seemed to work, what i found was that the gradle-wrapper.properties was using and older version (4.5) instead of the 4.6 i had in the newer project. Changing this as well as reverting to classpath 'com.android.tools.build:gradle:3.2.0-alpha08' from alpha15 seemed to do the trick. I think you can use the alpha 15 if you like, but to be sure you can use the classpath 'com.android.tools.build:gradle:3.1.2'.
Along with all these changes the firebase-core and the google-gms-services should be set to version 16.0.0.
Unfortunately google play service has been stopped
This widows msg are generated &never run any google service performs