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

后端 未结 6 1325
眼角桃花
眼角桃花 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: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'
    

提交回复
热议问题