As per this SO thread, I know there are version conflicts, but issue still persists after new versions from Google.
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 10.0.1.
My build.gradle(Module: app)
....
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
}
apply plugin: 'com.google.gms.google-services'
What changes are required now?
I think you change
compile 'com.google.firebase:firebase-messaging:11.0.4'
Same error gets thrown when
apply plugin: 'com.google.gms.google-services'
is not added to bottom of the module build.gradle file.
You must use only one version for all 3 libs
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
OR only use only 10.0.1 for 3 libs
Please change your project-level build.gradle file in which you have to change your dependencies class path of google-services or build.gradle path.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
}
}
The google play services requires all its dependencies to have the same version. But if you look at your dependencies:
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
There is one that has a different version.
It can be solved by changing the version to (in this case) 11.0.4.
This applies to both Firebase and Google Play Services - both have to have matching versions that also correspond with each other. If a Firebase dependency is 10.0.1 and a Google Play Services dependency is 11.0.4, the same error will occur.
Note that in some cases, there can be a library that has a different version of a library (e.g. library x uses play-services-games:10.0.1 while you use 11.0.4 for the dependencies in your app)
Edit
This answer does NOT cover the newer versions where versions are individual. Update com.google.gms:google-services:4.1.0 and check mvnrepository (or some other maven/gradle artifact search tool) to find the newest versions.
With
com.android.tools.build:gradle:3.2.0
You have to use:
classpath 'com.google.gms:google-services:4.1.0'
This fixed my problem
For fire base to install properly all the versions of the fire base compiles must be in same version so
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
this is the correct way to do it.
Initially, the firebase database was pointing to 11.8.0 .after changing all the related jars to 11.0.4 this issue is resolved at changes the SDK level.
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
Important Update
Both Firebase & Play-service dependencies are having independent versions unlike past. If
you have version conflicts then you can update your
com.google.gms:google-services. and start defining independent version.
Step(1): Update com.google.gms:google-services
Open project level build.gradle and update com.google.gms:google-services to version 4.1.0 MUST CHECK newer if available.
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.1.0' //< update this
}
}
Step(2): Update Firebase dependencies Latest Versions
Firebase dependency versions can be individual.
com.google.firebase:firebase-core:16.0.3 //Analytics, check latest too
com.google.firebase:firebase-database:16.0.2 //Realtime Database, check latest too
Step(3): Update Play Services dependencies Latest Versions
Play services versions also can have individual versions.
com.google.android.gms:play-services-ads:17.1.2 //Ads, check latest too
com.google.android.gms:play-services-analytics:16.0.6 //Analytics, check latest too
Still having issue?
You can check which dependency is making conflict by reading this answer.
Update google services and Firebase library to latest version
google services
classpath 'com.google.gms:google-services:4.3.1'
firebase
implementation 'com.google.firebase:firebase-database:19.0.0'
as the message says go to:
com.google.gms.google-services versions
And copy the last version's number . Mine was less than 3.3.1.
Then in project's build.gradle put/change dependencies node as :
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2' // as it was before
classpath 'com.google.gms:google-services:3.3.1' // <-- the version change
}
Then I synced the project and error went
All google services should be of same version, try matching every versions.
Correct one is :
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
Incorrect Config is :
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
After All Working for 6 hours i got the solution...
Simple Just what ever the plugins you defined in the build.gradle file... for ex: google services plugins or firebase plugins or any third party plugins all the **version code** should be same..
Example: In my application i am using following plugins...
// google services plugins
implementation 'com.google.android.gms:play-services-analytics:10.0.1'
implementation 'com.google.android.gms:play-services-gcm:10.0.1'
implementation 'com.google.android.gms:play-services-base:11.6.1'
implementation 'com.google.android.gms:play-services-auth-api-phone:11.6.0'
//firebase plugin
implementation 'com.google.firebase:firebase-ads:10.0.1'
//Third Party plugin
implementation 'com.google.android.gms:play-services-auth:16.0.0'
In the above plugins version code(ex:10.0.1, 16.0.0, 11.6.1) are different I was facing fix the version conflict (google-services plugin) issue
Below for all plugins i have given single version code(11.6.0) and the issue is resovled...
// google services plugins
implementation 'com.google.android.gms:play-services-analytics:11.6.0'
implementation 'com.google.android.gms:play-services-gcm:11.6.0'
implementation 'com.google.android.gms:play-services-base:11.6.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:11.6.0'
//firebase plugin
implementation 'com.google.firebase:firebase-ads:11.6.0'
//Third Party plugin
implementation 'com.google.android.gms:play-services-auth:11.6.0'
**Syn Gradle**...
Go to Build>>Rebuild Projcet...
Sure it will work....#Ambilpura
install or update google play services. Secondly, check your 'com.google.gms:google-services:3.0.0' version . Check , this by upgrading it if still not work to 3.1.0
Related
I'm trying to integrate Firebase Performance SDK. It occurs this conflict on this line (marked red line by Analysis) and crash after launch the app:
compile 'com.google.android.gms:play-services-ads:16.0.0'
All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 17.1.0, 17.0.5, 17.0.3, 17.0.1, 16.3.0, 16.2.3, 16.2.1, 16.1.0, 16.0.7, 16.0.3, 16.0.1, 16.0.0.
I've searched and tried the related questions/answers of this similar title but no one can work.
The dependencies are listed below. Before I used all version 11.8.0 working well. Performance SDK wants me to use firebase-perf:16.2.3 and it start this problem. Even though I modify all of them to 16.x.x, it still con't be fixed. I wonder whether it needs all of them in all the same subversion? But It can't be done for I've tried many of them lack a lot of subversions. For example if using all version 16.0.0, Some of them will occur "Failed to resolve:...".
build.gradle(Module:app)
compile 'com.google.android.gms:play-services-ads:16.0.0'
compile 'com.google.firebase:firebase-core:16.0.7'
compile 'com.google.firebase:firebase-ads:16.0.1'
compile 'com.google.firebase:firebase-auth:16.1.0'
compile 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-config:16.3.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-perf:16.2.3'
build.gradle(Project: xxxx)
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'io.fabric.tools:gradle:1.25.4' //for crashlytics
classpath 'com.google.firebase:firebase-plugins:1.1.5' //for performance
}
If you are using Android Studio: once the Gradle file is opened you should be able to see that some libraries are marked in yellow, if you hover the mouse over them a popup shows which are the latest version so you can start by replacing all of them with the latest version. After that cleaning and rebuilding the project could help.
After trying a lot of hours, it happens to work on the following modifications.
Especially the "(", ")" are needed for 'com.google.android.gms:play-services-ads:16.0.0', otherwise the conflict will not disappear!
compile ('com.google.android.gms:play-services-ads:16.0.0')
compile ('com.google.firebase:firebase-core:16.0.7'){exclude group: "com.google.android.gms"}
compile ('com.google.firebase:firebase-ads:16.0.1'){exclude group: "com.google.android.gms"}
compile ('com.google.firebase:firebase-auth:16.1.0'){exclude group: "com.google.android.gms"}
compile ('com.google.firebase:firebase-crash:16.2.1'){exclude group: "com.google.android.gms"}
implementation 'com.google.firebase:firebase-config:16.3.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-perf:16.0.0' //if using 16.2.3, sometime the app crashes as soon as it starts.
//Below post reported that some other bug from firebase-perf:16.1.0
//https://stackoverflow.com/a/51967966/8046317
Trying to create a simple app with FireStore and Google Authentication. Having problem with the gradle:
In project 'app' a resolved Google Play services library dependency
depends on another at an exact version (e.g. "[15.0. 1]", but isn't
being resolved to that version. Behavior exhibited by the library will
be unknown.
Dependency failing: com.google.android.gms:play-services-flags:15.0.1
-> com.google.android.gms:play-services-basement#[
15.0.1], but play-services-basement version was 16.0.1.
The following dependencies are project dependencies that are direct or
have transitive dependencies that lead to the art ifact with the
issue.
-- Project 'app' depends onto com.google.firebase:firebase-firestore#17.1.5
-- Project 'app' depends onto com.firebaseui:firebase-ui-auth#4.2.0
For extended debugging info execute Gradle from the command line with
./gradlew --info :app:assembleDebug to see the dep endency paths to
the artifact. This error message came from the google-services Gradle
plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding
"googleServices { disableVersionCheck = false }" to your b uild.gradle
file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "myapp.com"
minSdkVersion 19
targetSdkVersion 27
versionCode 11
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin
Project gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
Can somebody help me?
There are many answers here for individual solutions that do not really get down to the problem. Here is how to solve this in general:
As the original log output suggests, it is useful to run the build in the terminal with the following command:
./gradlew --info assembleDebug
This will give you a list of all dependencies that are involved in the conflict. It looks similar to this (I removed the package name stuff to make it a bit more readable):
Dependency Resolution Help: Displaying all currently known paths to any version of the dependency: Artifact(groupId=com.google.firebase, artifactId=firebase-iid)
-- task/module dep -> firebase-analytics#17.2.0
---- firebase-analytics:17.2.0 library depends -> play-services-measurement-api#17.2.0
------ play-services-measurement-api:17.2.0 library depends -> firebase-iid#19.0.0
-- task/module dep -> firebase-core#17.2.0
---- firebase-core:17.2.0 library depends -> firebase-analytics#17.2.0
------ firebase-analytics:17.2.0 library depends -> play-services-measurement-api#17.2.0
-------- play-services-measurement-api:17.2.0 library depends -> firebase-iid#19.0.0
-- task/module dep -> play-services-measurement-api#17.2.0
---- play-services-measurement-api:17.2.0 library depends -> firebase-iid#19.0.0
-- task/module dep -> firebase-iid#19.0.0
-- task/module dep -> firebase-messaging#17.1.0
---- firebase-messaging:17.1.0 library depends -> firebase-iid#[16.2.0]
-- task/module dep -> com.pressenger:sdk#4.8.0
---- com.pressenger:sdk:4.8.0 library depends -> firebase-messaging#17.1.0
------ firebase-messaging:17.1.0 library depends -> firebase-iid#[16.2.0]
From this list you get to know 2 things:
Where is the conflicting depedency found
What versions of the conflicting dependency are set up
In my case the conflicting dependency is firebase-iid: It's either #19.0.0 or #16.2.0
To fix this you must define the top-level dependency of the wrong firebase-iid explicitly in your build.gralde.
So in the upper log you can see that there are 2 examples of an out-dated version of firebase-iid#16.2.0. One comes from -- task/module dep -> firebase-messaging#17.1.0 the other one from a third-party library (pressenger). We don't have influence on the third-party library, so nothing to do here.
But for the other dependency, we have to declare it explicitly with the correct version:
implementation 'com.google.firebase:firebase-messaging:20.0.0'
Now the build works again. Happy ending :)
There's a known bug with Google Services 4.2.0 that may cause this. Downgrading your google-services version to 4.1.0 in your project's build.gradle may resolve the issue
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.1.0' //decreased from 4.2.0
}
}
The problem was it was missing a dependency.
Adding com.google.firebase:firebase-auth solved the issue.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
// implementation'com.google.firebase:firebase-core:16.0.6'
// implementation'com.google.firebase:firebase-storage:16.0.5'
implementation'com.google.firebase:firebase-auth:16.1.0' => add this line
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
}
There was a bug related to google-services that was eventually fixed in version 4.3.3.
So you can either use 4.3.3 or the latest version (check here)
classpath 'com.google.gms:google-services:4.3.3' // or latest version
or downgrade to 4.1.0
classpath 'com.google.gms:google-services:4.1.0'
i added the latest version of firebase messaging to build.gradle (Module: app) in my project and problem solved
implementation 'com.google.firebase:firebase-messaging:20.0.0'
Your app/build.gradle might have these lemon color blocked on dependencies part in Android Studio like on the picture below,
These (lemon color blocks) mean it's not latest version of dependency. just put mouse on each block, then IDE (Android Studio) tells the numbers that have to be changed.
Updating all my Google Play Services libraries to the latest in ALL modules solved the issue for me. I don't see that you have any Google Play Services libraries, but I wanna leave this answer here to those that might find this useful.
My project was working fine (No build issues). All of a sudden, I got this error
"resolved Google Play services library dependency depends on another at an exact version.."
I figured out that it was because I was building offline.
If anyone gets the same error, check if you are building offline.
Thanks, but unfortunately, this didn't entirely work for me. I also had to add the following to my build.grade (Module:app)
implementation 'com.google.android.gms:play-services-flags:16.0.1'
implementation 'com.google.android.gms:play-services-basement:16.0.1'
The problem was fixed after upgrading this lib in my project's build.gradle:
classpath 'com.google.gms:google-services:4.3.3'
and these ones in the app module's build.gradle:
implementation 'com.google.firebase:firebase-core:17.3.0'
implementation 'com.google.firebase:firebase-messaging:20.1.5'
After this, use Android Studio's Clean menu
I am using One Signal and caught this error once a time.
The reason was:
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
to put apply plugin for one signal before 'com.android.application'.
Maybe this will be useful for some other apply plugin too.
Add FCM to your App added Lower dependency Then I changed the dependency to the latest version this problem has solved.
compile 'com.google.firebase:firebase-messaging:17.3.4'
to
implementation 'com.google.firebase:firebase-messaging:20.0.0'
None of the other answers worked for me. My use-case is with React-Native 61+ trying to setup FCM and Analytics. What worked for me was using the latest google-services in android/build.gradle
dependencies {
classpath "com.android.tools.build:gradle:3.4.2"
classpath "com.google.gms:google-services:4.3.3" // Need the latest here
}
And then adding the gradle dependencies to android/app/build.gradle required for the products I'm using (in my case Analytics and Cloud Messaging) from here
dependencies {
...
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
...
}
I just tried #live-love's accepted answer myself and agree with the approach.
It might be more precise, however, to correct your dependencies according to the latest Google Services library version.
For my case, it happened when I just added/activated a Firebase service to the app.
You need to follow the latest version in project and Gradle app.
My app/build.gradle
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//Android Support Design Library
implementation 'com.android.support:design:27.1.1'
//RecyclerView
implementation 'com.android.support:recyclerview-v7:27.1.1'
// Support multidex
implementation 'com.android.support:multidex:1.0.3'
// Firebase Core
// implementation 'com.google.firebase:firebase-core:16.0.1'
//Firebase Authentication
implementation 'com.google.firebase:firebase-auth:19.3.1'
// Firestore Firestore
implementation 'com.google.firebase:firebase-firestore:21.4.3'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
// glide
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
// Circle ImageView
implementation 'de.hdodenhof:circleimageview:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
My project's build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Don't forget to sync the Gradle again.
The working solution for me was to remove "firebase-auth" and add "firebase-core" dependency. But after a couple of project rebuilds I started experiencing another compilation issue so I had to add the "firebase-auth" dependency in addition to the "firebase-core" in order to make it work:
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
Add the line below in you Project's build.gradle (See image below)
classpath 'com.google.gms:google-services:4.3.3'
Then update your Firebase related packages by going to :
File > Project Structure > Dependencies > app
Update Firebase modules to latest version (See the image below)
In my case I am using :
implementation 'com.google.firebase:firebase-database:19.3.0'
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.firebase:firebase-messaging:20.1.7'
implementation 'com.google.firebase:firebase-core:17.4.0'
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
Don't forget to add :
apply plugin: 'com.google.gms.google-services'
See my Module's build.gradle file below.
The ML Kit library had versioning problems in the latest release.
Google Play services library dependency depends on another at an exact version error (thrown by the google-services plugin)
Here is the link to the solution.
https://firebase.google.com/support/release-notes/android#bom_v25-8-0
This is new thing happen to me that If your network is not secure and you are getting prompt of Untrusted Certificate.
If you will Accept or Reject, It will give this error until your network will not be secure.
You can work offline by checking Setting -> Gradle -> Offline Mode
If you used song haesuk answer, you need to do it for both build.gradle Project (classpath in dependencies), and in build.gradle app (implementations). Also do the same if you change builds for any libraries imported to the app.
I use suggestions provided by android studio and it changed implementations but did not change dependencies hence during build, there was a conflict between the two and it gave me same error.
I replicated the issue when I accidentally added com.google.firebase:firebase-ml-vision twice with different versions.
I resolved it by simply clearing the app-level dependencies block leaving just the default Android dependencies like so:
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'androidx.multidex:multidex:2.0.0'
}
This worked for me!
dependencies {
classpath "com.android.tools.build:gradle:3.4.2"
classpath "com.google.gms:google-services:4.3.3" // Need the latest here
}
dependencies {
...
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
...
}
In my case updating the firebase-bom and play services library to their latest version solved the issue:
In app level gradle :
implementation platform('com.google.firebase:firebase-bom:30.3.2')
In project level gradle :
classpath 'com.google.gms:google-services:4.3.13'
I am integrating Firebase messaging for a version. It is:
'com.google.firebase:firebase-messaging:15.0.2'
My classpath is:
classpath 'com.google.gms:google-services:3.2.0'
I had faced the following error:
Failed to resolve: firebase-messaging Open File
Change this:
classpath 'com.google.gms:google-services:3.2.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
into this:
classpath 'com.google.gms:google-services:4.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
Explanation:
Here in this case using firebase-messaging:15.0.2 with google-services:4.0.1 would work, since the most important thing was updating google-services above 3.2.0, and that's because google-services:3.3.0 is needed to be able to use the firebase library from version 15.0 and above. You can check this blog post. that explains the changes in versioning of firebase libraries.
But it is still better to update the google-services plugin to prevent any other errors with other dependencies.
Note:
The versions less than 15.0.0 are in google maven repository, so you can use them in gradle. But, you cannot mix version 15.0.0 with a version less than 15.0.0 and use google play services 4.0.1, as said in my answer here. That's why it is better to update firebase libraries to the latest versions.
According to the Guy4444 1 on the post 2 I have changed
implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'
to
implementation 'com.google.firebase:firebase-messaging:17.0.0'
and it solved the problem!
I got it resolved by changing
this
implementation 'com.google.firebase:firebase-messaging:17.0.0:15.0.0'
to this
implementation 'com.google.firebase:firebase-messaging:17.0.0'
I get the error com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzau; when i run my app
The gradle files are
app.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.google.android.gms:play-services:7.0.+'
compile 'com.android.support:mediarouter-v7:21.0.3'
compile 'com.squareup:otto:1.3.5'
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.4.0'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.edmodo:rangebar:1.0.0'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile project(':library_viewpager')
compile project(':androidHorizontalListView')
compile project(':CastCompanionLibrary')
compile project(':mobihelp_sdk_android_v1.4')
compile fileTree(include: 'Parse-*.jar', dir: 'libs')
compile files('libs/Parse-1.9.2.jar')
compile files('libs/GoogleConversionTrackingSdk-2.2.2.jar')
}
CastCompanionLibrary
dependencies {
compile 'com.android.support:appcompat-v7:22.+'
compile 'com.android.support:mediarouter-v7:22.+'
compile 'com.google.android.gms:play-services-cast:7.5.0'
}
How do i fix this? i guess the error occurs because i use google play services in both the module and the app. but the versions are different. is that causing an issue?
I had similar problem and your question helped me solve mine and probably will help you solve yours. Problem is that you have defined:
dependencies {
...
compile 'com.google.android.gms:play-services-cast:7.5.0'
}
and
dependencies {
...
compile 'com.google.android.gms:play-services:7.0.+'
...
}
Since google services 7.5.0, if you're using single modules from play services you can't use whole play services as dependency simultaneously. Solution is to select only those services that you need instead of whole package e.g.:
instead of
dependencies {
...
compile 'com.google.android.gms:play-services:7.0.+'
...
}
use
dependencies {
...
compile 'com.google.android.gms:play-services-maps:7.0.+'
compile 'com.google.android.gms:play-services-location:7.0.+'
compile 'com.google.android.gms:play-services-gcm:7.0.+'
...
}
Also I'm not sure but probably it would be good idea to use the same version of google services in both gradle configs.
I had a similar problem after building using phonegap/cordova:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzsk;
I fixed it by editing build.gradle(module Android), as I had 2 libraries that should have the exact same version with different version numbers (8.4.0 and 9.2.1 in my case)
dependencies{
....
//make sure are both same version (8.4.0 or 9.2.1 in my case)
compile 'com.google.android.gms:play-services-gcm:9.2.1'
// this is the one I changed: compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-location:9.2.1' // it was 8.4.0
....
}
Firebase Android SDKs now have independent version numbers, allowing
for more frequent, flexible updates.
Update all your Firebase dependencies to the latest version (as of 2 May 2018):
Firebase Core com.google.firebase:firebase-core:15.0.2
Ads com.google.firebase:firebase-ads:15.0.0
Analytics com.google.firebase:firebase-analytics:15.0.2
App Indexing com.google.firebase:firebase-appindexing:15.0.0
Authentication com.google.firebase:firebase-auth:15.1.0
Cloud Firestore com.google.firebase:firebase-firestore:16.0.0
Cloud Functions com.google.firebase:firebase-functions:15.0.0
Cloud Messaging com.google.firebase:firebase-messaging:15.0.2
Cloud Storage com.google.firebase:firebase-storage:15.0.2
Crash Reporting com.google.firebase:firebase-crash:15.0.2
Crashlytics com.crashlytics.sdk.android:crashlytics:2.9.1
Invites com.google.firebase:firebase-invites:15.0.2
Performance Monitoring com.google.firebase:firebase-perf:15.1.0
Realtime Database com.google.firebase:firebase-database:15.0.0
Remote Config com.google.firebase:firebase-config:15.0.2
Release note: https://firebase.google.com/support/release-notes/android
I encountered the same issue after manually adding Firebase to my app.
For me the solution was changing:
classpath 'com.google.gms:google-services:3.2.0'
to:
classpath 'com.google.gms:google-services:3.0.0'
in the root-level build.gradle file.
If this is happening with react-native-device-info, you can only change from:
compile(project(':react-native-device-info'))
to
compile(project(':react-native-device-info')) {
exclude group: 'com.google.android.gms'
}
As described here:
https://github.com/rebeccahughes/react-native-device-info/blob/81b0c20fab8a10ccf0341dbd6710d7a5915b06a6/README.md#troubleshooting
Had the same issue while integrating firebase. For my case, it was caused by version mismatch.
on the app gradle, i had:
ext {
PLAY_SERVICES_VERSION = '10.2.0'
}
dependencies {
compile "com.google.android.gms:play-services-maps:$PLAY_SERVICES_VERSION"
compile "com.google.android.gms:play-services-location:$PLAY_SERVICES_VERSION"
compile "com.google.android.gms:play-services-places:$PLAY_SERVICES_VERSION"
compile 'com.google.firebase:firebase-database:10.0.1'
}
the firebase dependancy was added through the integrated firebase plugin in Android studio. When i matched the versions, it worked.
I had this issue recently, the reason was the version difference:
'com.google.firebase:firebase-ads:9.0.6'
'com.google.firebase:firebase-crash:11.0.2'
so make sure you have the same version.
I had the same problem but mine was cause by firebase-ui newest version 2.0.0. So I downgraded to 1.2.0 and added the following line to Project level build.gradle file:
allprojects {
repositories {
jcenter()
// Add the following code
maven {
url 'https://maven.fabric.io/public'
}
}
}
My project is a cordova ionic1 project, I spent a full night and morning to solve this issue, this is what I did beacuse i was having firebase dependencies and google services:
Go to this file :
platforms\android\cordova-plugin-firebase\cordova-plugin-firebase\app-build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
// classpath 'com.google.gms:google-services:3.0.0'
// i changed the above line from 3.0.0 to 3.1.1
classpath 'com.google.gms:google-services:3.1.1'
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'me.leolin:ShortcutBadger:1.1.4#aar'
//compile 'com.google.firebase:firebase-crash:+'
// i changed the above line from + to 11.0.2
compile 'com.google.firebase:firebase-crash:11.0.2'
}
Then Go to this file:
platforms\android\project.properties
Originally i was having this
target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-firebase/app-build.gradle
cordova.system.library.1=com.google.gms:google-services:+
cordova.system.library.2=com.google.firebase:firebase-core:+
cordova.system.library.3=com.google.firebase:firebase-messaging:+
cordova.system.library.4=com.google.firebase:firebase-crash:+
cordova.system.library.5=com.google.firebase:firebase-config:+
cordova.system.library.6=com.android.support:support-v4:24.1.1+
cordova.system.library.7=com.google.android.gms:play-services-auth:11.+
cordova.system.library.8=com.google.android.gms:play-services-identity:11.+
Then i commented out the google services as we need specific dependencies and I also put the versions for firebase and gms to the same version number of 11.0.2
so after my file looks like this
target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-firebase/app-build.gradle
# cordova.system.library.1=com.google.gms:google-services:+
cordova.system.library.2=com.google.firebase:firebase-core:11.0.2
cordova.system.library.3=com.google.firebase:firebase-messaging:11.0.2
cordova.system.library.4=com.google.firebase:firebase-crash:11.0.2
cordova.system.library.5=com.google.firebase:firebase-config:11.0.2
cordova.system.library.6=com.android.support:support-v4:24.1.1+
cordova.system.library.7=com.google.android.gms:play-services-auth:11.0.2
cordova.system.library.8=com.google.android.gms:play-services-identity:11.0.2
If anyone had the same issues as mine, I removed the firebase-core dependency and it worked like a charm.
dependencies{
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.android.gms:play-services-ads:15.0.0'
implementation 'com.google.firebase:firebase-crash:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
}
to
dependencies{
implementation 'com.google.android.gms:play-services-ads:15.0.0'
implementation 'com.google.firebase:firebase-crash:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
}
I was having this issue and none of the solutions worked. What worked for me was adding this plugin
cordova plugin add cordova-android-play-services-gradle-release --save
and then in both /platforms/android/cordova-plugin-fcm/ and /platforms/android/cordova-plugin-open/ replace
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
with:
ext.postBuildExtras = {
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}
If anyone else comes across this issue in Ionic removing and re-adding the platform worked for me:
> ionic cordova rm platform android
> ionic cordova add platform android
For anyone wondering how to fix this for Apache Cordova plugins, I fixed this problem by ensuring all plugin.xml files include the same major and minor version, but latest revision, like this:
<framework src="com.google.firebase:firebase-auth:15.0.+" />
<framework src="com.google.firebase:firebase-messaging:15.0.+" />
When using 15.0.0 above, the com.android.dex.DexException error was raised for some reason. By using + for the revision number (which means, latest), everything worked perfectly with cordova 7.1.0 and cordova-android 6.3.0.
Remember to remove and re-add the android platform after editing plugin.xml from plugins, otherwise your changes won't be applied at all!
Also: Ensure only ONE gradle file is applying this, just in case:
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:3.0.0'
}
I was also having this issue, I tried many ways to solve this issue. What worked for me was removing following line from my gradle.
compile 'com.google.firebase:firebase-core:16.0.3'
At first I have both firebase-core and firebase-ml-vision (what I need was only firebase-ml-vision) like following.
compile 'com.google.firebase:firebase-ml-vision:17.0.0'
compile 'com.google.firebase:firebase-core:16.0.3'
After I remove the line I got following warning,
Warning: The app gradle file must have a dependency on
com.google.firebase:firebase-core for Firebase services to work as
intended.
But, according to official docs the core dependency can be absent (https://firebase.google.com/docs/ml-kit/android/detect-faces), so it can be ignored.
I'm using the following dependencies:
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.firebaseui:firebase-ui-database:1.1.1'
compile 'com.firebaseui:firebase-ui-auth:1.1.1'
compile 'com.google.android.gms:play-services:10.0.1'
In the Gradle file an error is shown:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 25.3.0, 25.1.0, 24.0.0......
I can't update
com.google.android.gms:play-services:10.0.1
because i get the following error:
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 10.0.1.
When i remove the Firebase dependencies the error is gone. What causes this error and how can i get rid of it?
The com.firebaseui:firebase-ui-auth:10.0.1 library has transitive dependencies on:
com.android.support:cardview-v7:25.1.0
com.android.support:customtabs:25.1.0
You can force use of a newer version by explicitly including it in your dependencies:
compile "com.android.support:cardview-v7:25.3.0"
compile "com.android.support:customtabs:25.3.0"
The other version listed in the warning message, 24.0.0, must be from the Play Services library. In Android Studio, you can open the Gradle window and double-click on :app > Tasks > android > androidDependencies to get a dependency report to find the conflicting libraries.
I would also strongly recommend replacing:
compile 'com.google.android.gms:play-services:10.0.1'
with the specific APIs you need. They are listed here in Table 1. Including the single play-services library pulls in ALL the APIs, needlessly increasing the size of your APK and frequently requiring Multidex.
See this related question for further discussion of this issue.
did you add the classpath 'com.google.gms:google-services:versionĀ· to the dependencies and the apply plugin: 'com.google.gms.google-services' to the build.gradle ?
and change the compile 'com.android.support:support-v4:25.3.0' by com.android.support:support-v7:25.3.0'