Reputation: 6974
In my app I have these dependencies:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.package_app.name"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-messaging:9.2.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:design:23.2.1'
compile "com.android.support:recyclerview-v7:23.2.1"
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.google.android.gms:play-services-maps:9.4.0'
}
Below these dependencise I put
apply plugin: 'com.google.gms.google-services'
But I can't build app because return this error.
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 9.2.0.
So I tried to put
compile 'com.google.android.gms:play-services-maps:9.2.0'
And the app build, so my question is: Why I can't use the last versione of services-map?
Upvotes: 3
Views: 1170
Reputation: 363439
It happens because you are using
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-messaging:9.2.0'
As you can find in the pom file of these dependencies:
<artifactId>firebase-analytics</artifactId>
<version>9.4.0</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-basement</artifactId>
<version>9.2.0</version>
<scope>compile</scope>
<type>aar</type>
</dependency>
they are using the com.google.android.gms
libraries with 9.2.0.
Use
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
Upvotes: 1
Reputation: 2297
I faced the same issue yesterday and solved it by doing the follows :
Firstly, make sure that you project/top level gradle file has the latest version for google services inside dependencies
classpath 'com.google.gms:google-services:3.0.0'
Secondly, make sure to put the plugin at the bottom of the gradle app file
apply plugin: 'com.google.gms.google-services'
And make sure all google services dependencies including firebase are of the same version i.e. 9.4.0
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
This is what i currently have in my app.gradle dependencies.
Upvotes: 2
Reputation: 627
Make sure in the root build.gradle
you have the latest plugin reference.
Also if you recently updated the play services and all references are good - try to clean the gradle cache by calling rm -rf ~/.gradle/cache
, sometimes it helps
buildscript {
repositories {
jcenter()
}
dependencies {
//...
classpath 'com.google.gms:google-services:3.0.0'
}
}
Upvotes: 0
Reputation: 490
Change this :
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-messaging:9.2.0'
by
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
Upvotes: -1
Reputation: 5363
Add this line to end of build.gradle
apply plugin: 'com.google.gms.google-services'
And add this classpath (other build.gradle
)
classpath 'com.google.gms:google-services:3.0.0'
Upvotes: 3