构建错误。gradle com.google.android.gms:play-services-maps:9.4.0

时间:2021-09-23 21:09:19

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.

但是我不能构建app因为返回这个错误。

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?

我的问题是:为什么我不能使用服务地图的最后一个版本?

5 个解决方案

#1


2  

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

其次,一定要把插件放在gradle应用文件的底部

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

并确保包括firebase在内的所有谷歌服务依赖项都是相同的版本,即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.

这就是我目前在app.gradle依赖项中的内容。

#2


3  

Add this line to end of build.gradle

把这条线加到建筑物的尽头

apply plugin: 'com.google.gms.google-services' 

And add this classpath (other build.gradle)

并添加此类路径(其他构建。gradle)

classpath 'com.google.gms:google-services:3.0.0'

#3


1  

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:

您可以在这些依赖项的pom文件中找到:

 <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.

他们正在使用com.google.android。gms和9.2.0库。

Use

使用

compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'

#4


0  

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

另外,如果您最近更新了play服务和所有引用都很好,请尝试通过调用rm -rf ~/来清理等级缓存。gradle /缓存,有时它帮助

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        //...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

#5


-1  

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'

#1


2  

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

其次,一定要把插件放在gradle应用文件的底部

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

并确保包括firebase在内的所有谷歌服务依赖项都是相同的版本,即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.

这就是我目前在app.gradle依赖项中的内容。

#2


3  

Add this line to end of build.gradle

把这条线加到建筑物的尽头

apply plugin: 'com.google.gms.google-services' 

And add this classpath (other build.gradle)

并添加此类路径(其他构建。gradle)

classpath 'com.google.gms:google-services:3.0.0'

#3


1  

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:

您可以在这些依赖项的pom文件中找到:

 <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.

他们正在使用com.google.android。gms和9.2.0库。

Use

使用

compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'

#4


0  

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

另外,如果您最近更新了play服务和所有引用都很好,请尝试通过调用rm -rf ~/来清理等级缓存。gradle /缓存,有时它帮助

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        //...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

#5


-1  

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'