简体   繁体   English

Android Google Services插件版本冲突

[英]Android google services plugin version conflict

I recently upgraded Android Studio to 3.1 and I am tuck with version conflict problem.My Gradle version is 4.4 and Andoid plugin version is 3.0.0. 我最近将Android Studio升级到3.1,并且遇到版本冲突问题。我的Gradle版本是4.4, Andoid插件版本是3.0.0。 I tried changing it to 3.1.1.It gets reverted back to the previous version mumber. 我尝试将其更改为3.1.1,并将其还原为以前的版本。 It is getting confusing for me,so your help is needed. 这让我感到困惑,因此需要您的帮助。 When syncing I get the following message in the Build. 同步时,我在Build中收到以下消息。

Version Conflict: 版本冲突:

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

build.gradle/app build.gradle / app

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

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.globemaster.samples"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:27.0.0'
    implementation 'com.android.support:design:27.0.0'
    implementation 'com.payumoney.sdkui:plug-n-play:1.2.0'
    implementation 'com.google.firebase:firebase-auth:15.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.firebase:firebase-core:15.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
    implementation 'com.google.android.gms:play-services-location:15.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

build.gradle build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.2.1'



        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Move this line at last apply plugin: 'com.google.gms.google-services' 最后移动此行以应用插件:“ com.google.gms.google-services”

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.globemaster.samples"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //
    //
}
apply plugin: 'com.google.gms.google-services'

At the bottom of the (app)build.gradle script and rebuild the project. 在(app)build.gradle脚本的底部,并重新生成项目。

Note:- I think that it has to do something with referencing dependencies that have not yet been created. 注意:-我认为它必须对尚未创建的依赖项进行引用。 Something like calling a variable before you even declare it 甚至在声明变量之前就先调用它

请在您的应用程序构建gradle.file中添加以下代码

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

I hope this will work for you 我希望这对你有用

Change your classpath to 3.1.1 将您的类路径更改为3.1.1

classpath 'com.android.tools.build:gradle:3.1.1'

And apply plugin after dependencies in app gradle file 并在应用程序gradle文件中依赖后应用插件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 适用于Google服务的Android版本冲突 - Android Version Conflict for Google Services 版本冲突(Google服务插件) - Version conflict (google-services plugin) 通过更新google-services插件的版本或将com.google.android.gms的版本更新为8.3.0产生冲突 - conflict either by updating the version of the google-services plugin or updating the version of com.google.android.gms to 8.3.0 通过更新google-services插件的版本来解决版本冲突 - fix the version conflict either by updating the version of the google-services plugin Google服务版本冲突 - Version conflict of google services Google服务版本冲突 - Google Services Version conflict Android Gradle:添加firebase:firebase-core后,google-services插件的版本冲突 - Android Gradle: Version conflict of the google-services plugin after added firebase:firebase-core 请通过更新google-services插件的版本或将com.google.android.gms更新到9.4.0来解决版本冲突。 - Please fix the version conflict either by updating the version of the google-services plugin or updating com.google.android.gms to 9.4.0 错误:使用productFlavors修复版本冲突(google-services插件) - Error: fix the version conflict (google-services plugin) using productFlavors 错误:修复版本冲突(google-services 插件) - Error: fix the version conflict (google-services plugin)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM