Android fire base和google play服务可以';无法解决异常

Android fire base和google play服务可以';无法解决异常,android,firebase,android-studio,android-gradle-plugin,Android,Firebase,Android Studio,Android Gradle Plugin,我正在尝试使用以下gradle文件构建我的应用程序: apply plugin: 'com.android.application' android { compileSdkVersion 27 buildToolsVersion '28.0.0 rc1' defaultConfig { applicationId "com.wallet" minSdkVersion 17 targetSdkVersion 27 versionCode 1 versi

我正在尝试使用以下
gradle
文件构建我的应用程序:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '28.0.0 rc1'

defaultConfig {
    applicationId "com.wallet"
    minSdkVersion 17
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    vectorDrawables.useSupportLibrary true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dataBinding {
    enabled = true
}
dexOptions {
    javaMaxHeapSize "4g"
}
lintOptions {
    abortOnError false
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso- 
core:2.2.2', {
    exclude group: 'com.android.support', module: 'support- 
ancom.android.supportnotations'
})
implementation('com.alibaba.android:ultraviewpager:1.0.6.1@aar') {
    transitive = true
}
implementation 'com.android.support:percent:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.koushikdutta.ion:ion:2.2.1'
implementation 'com.airbnb.android:lottie:2.5.4'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.orhanobut:logger:2.1.1'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.google.android.gms:play-services-ads-identifier:15.0.1'
implementation 'io.michaelrocks:libphonenumber-android:8.8.2'
implementation 'com.github.tamir7.contacts:contacts:1.1.7'
implementation 'com.cleveroad:slidingtutorial:1.0.8'
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.lifecycle:runtime:1.1.1"
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"

implementation 'com.appyvet:materialrangebar:1.4'
implementation "com.github.nisrulz:qreader:2.1.2"

implementation project(':library')

testImplementation 'junit:junit:4.12'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
apply plugin: 'com.google.gms.google-services'
项目的渐变文件:

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

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

allprojects {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.google.com' }
        maven { url "https://dl.bintray.com/krazykira/maven" }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
我得到以下错误:

Failed to resolve: play-services-base
Failed to resolve: play-services-ads-identifier
当我将
play services base
版本更改为15.0.0时,此错误已修复,但当我对
play services广告标识符执行相同操作时,没有任何更改。我是否知道问题出在哪里,或者如何使应用程序与当前版本兼容


任何帮助都将不胜感激3>

由于我不知道的原因,
google()
必须出现在存储库列表中
jcenter()
之前,如所示

buildscript{
存储库{

谷歌()//第一个秋天应用插件:“com.google.gms.google services”添加到gradle中的顶部,并检查ur sdk管理器。您应该安装google Play服务。@GobuCSG由于google文档,它必须位于gradle文件的底部,我已经安装了google Play服务。您正在使用
firebase消息传递
。为什么需要
>播放服务gcm
?将您的项目
build.gradle
添加到帖子中。@BobSnyder刚刚添加。
buildscript {
    repositories {
        google() // <== CHANGED
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

allprojects {
    repositories {
        google() // <= CHANGED
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.google.com' }
        maven { url "https://dl.bintray.com/krazykira/maven" }
    }
}