【问题标题】:Gradle cannot resolve the most recent Firebase libraries , i.e, versions of 9.4.0Gradle 无法解析最新的 Firebase 库,即 9.4.0 版本
【发布时间】:2016-12-14 20:49:11
【问题描述】:

我正在尝试将我的 Firebase 库升级到新的 9.4.0 版本;但是,我在同步时在 Gradle 中收到“无法解决”错误。这是错误:

Error:(38, 13) Failed to resolve: com.google.firebase:firebase-core:9.4.0
Error:(40, 13) Failed to resolve: com.google.firebase:firebase-auth:9.4.0
Error:(40, 13) Failed to resolve: com.google.firebase:firebase-storage:9.4.0

尝试使用和不使用 firebase-core,没有区别。

这是我的应用和项目级别的 Gradle: 项目级别:

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

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

对于模块:应用程序级别: 应用插件:'com.android.application'

    android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
    applicationId "com.example.main.projectone"
    minSdkVersion 18
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
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.google.android.gms:play-services-gcm:9.2.0'
//  compile 'com.google.android.gms:play-services:9.2.1'

compile('com.facebook.android:facebook-android-sdk:4.7.0') {
    exclude module: 'bolts-android'
}

//  compile 'com.fasterxml.jackson.core:jackson-core:2.8.1'
// compile 'com.fasterxml.jackson.core:jackson-databind:2.8.1'


compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-storage:9.4.0'
compile 'com.android.support:design:24.0.0'
compile 'com.parse:parse-android:1.13.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
}

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

知道为什么 Gradle 无法解析库吗?这是针对他们的 Firebase 网站Firebase Newest Libs。感谢你的帮助。

【问题讨论】:

标签: android-studio firebase android-gradle-plugin


【解决方案1】:

在 Android Studio 中更新 SDK 工具。将 Google Play 服务和 Google 存储库升级到最新版本后,我能够解决最新版本 9.4.0 的 Firebase 库

面临的相同问题

【讨论】:

    【解决方案2】:

    我遇到了完全相同的问题,但不明白,但是为我解决了什么问题:

    我去了 SDK Manager -> SDK Tools 并将“Google Repository”从第 31 版更新到第 32 版。之后我尝试再次同步我的项目,它神奇地工作了。

    【讨论】:

    • 我认为需要更新 google 存储库,但我不知道在 SDK 中下载后需要手动更改某些内容。谢谢大佬。
    【解决方案3】:

    在您的 module:app 中,尝试添加 compile 'com.google.android.gms:play-services:9.4.0' 而不是 compile 'com.google.android.gms:play-services:9.2.1',因为您正在使用新的 9.4.0 版本的所有 Firebase 库。或者您可以按照Setting Up Google Play Services中的建议选择所需的新库

    【讨论】:

      【解决方案4】:

      添加 SDK

      如果您想将 Firebase 库集成到您自己的项目中,您需要执行一些基本任务来准备您的 Android Studio 项目。作为将 Firebase 添加到应用的一部分,您可能已经这样做了。 首先,将规则添加到您的根级 build.gradle 文件,以包含 google-services 插件和 Google 的 Maven 存储库:

      版本:12.0.1

      buildscript {    
          dependencies {        
              classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
          }
      }
      
      allprojects {        
          repositories {            
              maven {
                  url "https://maven.google.com" // Google's Maven repository
              }
          }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-05-07
        • 1970-01-01
        • 1970-01-01
        • 2013-12-30
        • 2019-06-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多