Upgrade to Google Play Services:9.0.0 Error Failed to resolve: com.google.android.gms:play-services-measurement:9.0.0

后端 未结 6 1274
眼角桃花
眼角桃花 2020-11-27 03:28

I upgraded my build.gradle file from

compile \'com.google.android.gms:play-services:8.4.0\'

to

compile \'com.google.android.g

相关标签:
6条回答
  • 2020-11-27 03:40

    GCM has been rebranded to Firebase Cloud Messaging (FCM), If you want to use com.google.android.gms:play-services:9.0.0 read this article FCM. Do this maybe work, modify your build.gradle file to use the plugin.

    buildscript {
      dependencies {
        // Add this line
        classpath 'com.google.gms:google-services:3.0.0'
      }
    }
    
    0 讨论(0)
  • 2020-11-27 03:44

    This was found to fix the problem.

    Update your classpath in project level gradle com.google.gms:google-services:2.1.0 to classpath com.google.gms:google-services:3.0.0

    0 讨论(0)
  • 2020-11-27 03:45

    When changing play services to a version above 10.2.1 my dependencies started to fail resolving.

    I found out that changing the following maven URL solved the issue:

    maven { url 'https://raw.githubusercontent.com/onepf/OPF-mvn-repo/master/' }
    

    to

    maven { url 'https://github.com/onepf/OPF-mvn-repo/raw/master/' }
    

    It might that the URL change avoids a cache it in gradle or maven and that resolves it.

    0 讨论(0)
  • 2020-11-27 03:49

    Required: Latest versions of Android Studio and Google Play Services

    You can add the plugin to your project by updating your top-level build.gradle and your app-level build.gradle files as follows:

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

    Like

     // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            jcenter()
            mavenLocal()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.0'
            classpath 'com.google.gms:google-services:3.0.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            jcenter()
            mavenLocal()
        }
    }
    

    Now, you need to add a dependency for Google Play Services. Inside your app's build.gradle add:

    compile 'com.google.android.gms:play-services:9.6.1'
    

    Finally

        apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 24
        buildToolsVersion "24.0.2"
    
        defaultConfig {
            applicationId "// set Yours"
            minSdkVersion 15
            targetSdkVersion 24
            versionCode 1
            versionName "1.0"
    
    
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        packagingOptions {
            exclude 'LICENSE.txt'
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.google.android.gms:play-services-gcm:9.6.1'
        compile 'com.android.support:appcompat-v7:24.2.0'
    
    }
    
    apply plugin: 'com.google.gms.google-services'
    
    0 讨论(0)
  • 2020-11-27 03:55

    The easiest way I found is to use the latest version for all.

    dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //apply plugin: 'com.google.gms.google-services' //Firebase
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
    compile 'com.google.firebase:firebase-auth:10.2.6'
    compile 'com.google.android.gms:play-services-auth:10.2.6' //10.2.6
    compile 'com.google.firebase:firebase-core:10.2.6' // used for FCM
    compile 'com.google.firebase:firebase-messaging:10.2.6' // used for FCM
    testCompile 'junit:junit:4.12'
    //  apply plugin: 'com.google.gms.google-services'
    

    }

    EXPLAINATION

    apply plugin: 'com.google.gms.google-services' // Add this at bottom.

    • First, apply plugin: 'com.google.gms.google-services' // Add this at bottom.
    • Then, add these into dependencies

      compile 'com.google.firebase:firebase-auth:10.2.6' // make suere this is in latest version.

      compile 'com.google.android.gms:play-services-auth:10.2.6' //10.2.6 Latest

      compile 'com.google.firebase:firebase-core:10.2.6' // used for FCM

      compile 'com.google.firebase:firebase-messaging:10.2.6' // used for FCM

    Suppose if you have firebase-auth 10.2.6 that is latest today 25, May 2017, But simultaneously you're using play-services-auth:9.0.0 or below than latest, then they both can't make the connection and show you the error.

    I hope this helped.

    0 讨论(0)
  • 2020-11-27 03:58

    I solved this tricky problem by changing the string in Gradle to

    compile 'com.google.android.gms:play-services:9.0.0' //or latest version
    
    0 讨论(0)
提交回复
热议问题