火基地和谷歌播放服务无法解决异常 [英] fire base and google play services can't resolve exception

查看:143
本文介绍了火基地和谷歌播放服务无法解决异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to build my application with the following gradle file:

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'

项目的gradle文件:

project' gradle file:

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-ads-identifier执行相同操作时,则没有更改.无论如何,我是否可以了解问题所在,或者如何使该应用程序与当前版本一起使用?

when I change the play-services-base version to 15.0.0 this error is fixed but when I do the same for play-services-ads-identifier there's no change. Is there anyway for me to understand what is the problem or how can I make the app work with the current versions?

任何帮助将不胜感激3>

Any help would be appreciated 3>

推荐答案

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

For reasons unknown to me, google() must appear before jcenter() in the list of repositories, as is shown in the documentation.

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" }
    }
}

这篇关于火基地和谷歌播放服务无法解决异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆