添加编译时出错com.google.android.gms:play-services:11.0.1'

时间:2017-09-25 13:00:21

标签: android gradle android-gradle build.gradle android-gradle-3.0

我输入

时出错
compile 'com.google.android.gms:play-services:11.0.1'

enter image description here

 apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion "26.0.1"
        defaultConfig {
            applicationId "eyaa.compsproject"
            minSdkVersion 16
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support:design:25.3.1'
        compile 'com.android.support:cardview-v7:25.3.1'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        compile 'com.google.android.gms:play-services:11.0.1'
        compile 'com.google.firebase:firebase-core:10.0.1'
        compile 'com.google.firebase:firebase-database:10.0.1'
        testCompile 'junit:junit:4.12'
    }

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

为什么红色排成一线

compile 'com.android.support:appcompat-v7:25.3.1' 

使用时

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

1 个答案:

答案 0 :(得分:0)

播放服务和firebase版本需要相同, 请替换以下代码并检查。

compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'