Gradle未编译Firebase云消息传递

时间:2016-05-28 17:20:02

标签: android gradle firebase-cloud-messaging

我注意到Firebase API已从v 9.0.0升级到v 9.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

这是我的Gradle文件

Build.Gradle->应用

  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 个答案:

答案 0 :(得分:9)

您必须更新/安装Google Repository,修订版27

检查此答案:firebase setup on android

答案 1 :(得分:8)

我在" com.google.firebase:firebase-ads:9.0.1"上遇到了同样的问题,我所做的是从de SDK Manager Google Repository Extra安装。

答案 2 :(得分:1)

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

答案 3 :(得分:0)

对于mac os用户,更新SDK的一部分,如果您安装了带有和不带brew的ADK,请务必检查Android Studio中ADK的路径是否正确。我的问题是android studio自己恢复了原来的路径。