Gradle无法编译Firebase Cloud Messaging

4
我注意到Firebase API从v9.0.0升级到v9.0.1,因此决定进行更改。

但是并没有被注意到。

以下是Gradle Logcat中的错误:

   Error:(25, 13) Failed to resolve: com.google.firebase:firebase-messaging:9.0.1
   Error:(26, 13) Failed to resolve: com.google.firebase:firebase-core:9.0.1

And here are my Gradle Files

Build.Gradle-> App

  apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.example.lifeline.applicationgreat"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

 dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.firebase:firebase-messaging:9.0.1'
compile 'com.google.firebase:firebase-core:9.0.1'
}

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

Build.Gradle-> 项目

     // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.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()
} 
}

 task clean(type: Delete) {
delete rootProject.buildDir 
}

有人能告诉我错误在哪里或者我有什么遗漏吗? 另外,云消息传递是否需要Firebase-core的要求? 谢谢。
4个回答

9

8

我曾遇到与“com.google.firebase:firebase-ads:9.0.1”有关的问题。解决方法是从SDK管理器的Google存储库额外安装。


1

您需要前往Android SDK管理器并检查更新-您应该会看到Google Play服务SDK的更新,这将解决这些依赖关系。


我刚试了一下,还是不行。最初出现了一个关于守护进程问题的错误,但重新编译了三次后,同样的错误又出现了。 - Yash Jain

0
对于Mac OS用户而言,除了更新SDK之外,如果您已经使用brew安装了ADK,一定要确保在Android Studio中设置的ADK路径是正确的。我的问题是Android Studio自动回退到了旧路径。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接