如何获得包括不同的gms库?

时间:2018-09-10 12:38:39

标签: android android-gradle

我收到此警告,com.google.android.gms库必须使用准确的版本,但是我没有得到什么地方出了问题。 我的构建gradle

apply plugin: 'com.android.application'


android {
    compileSdkVersion 26
    buildToolsVersion "26.0.3"
    defaultConfig {
        applicationId "com.MyProject.sample"
        minSdkVersion 19
        targetSdkVersion 26
        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.squareup.picasso:picasso:2.5.2'

    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'

    //picture library
    compile 'com.github.bumptech.glide:glide:3.8.0'
    //recycler and card view
    compile 'com.android.support:support-v4:26.+'
    compile 'com.android.support:recyclerview-v7:26.+'
    compile 'com.android.support:cardview-v7:26.+'

    //json
    compile 'com.google.code.gson:gson:2.8.5'
    compile 'com.squareup.retrofit2:converter-gson:2.2.0'
    compile 'com.squareup.retrofit2:retrofit:2.4.0'
    //firebase
    compile 'com.google.firebase:firebase-core:16.0.1'
    compile 'com.google.firebase:firebase-messaging:17.3.0'
    compile 'com.google.android.gms:play-services-location:15.0.1'
    //compile 'com.google.android.gms:play-services-measurement-base:15.0.1'

    testCompile 'junit:junit:4.12'
}

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

我在类路径中包含了

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

还要添加Maven

maven { url "https://maven.google.com" }

我在此行收到警告

compile 'com.google.android.gms:play-services-location:15.0.1'

应用程序正在运行,并且一切正常。但是它说它可能在运行时崩溃。 预先感谢。

0 个答案:

没有答案