【问题标题】:could not find com.google.firebase:firebase-core:9.0.0 [duplicate]找不到 com.google.firebase:firebase-core:9.0.0 [重复]
【发布时间】:2016-09-15 10:14:49
【问题描述】:

在遵循有些不一致的指令 herehere 后,我在执行 gradle 同步时收到错误消息 could not find com.google.firebase:firebase-core:9.0.0

对为什么会发生这种情况有任何想法吗?

app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
        free {
            applicationId ... 
        }

        paid {
            applicationId ... 
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'

    freeCompile 'com.google.firebase:firebase-core:9.0.0'
    freeCompile 'com.google.firebase:firebase-ads:9.0.0:9.0.0'
}

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

root/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.neenbedankt.gradle.plugins:android-apt:1.8'
        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 非常简单,请参阅此处stackoverflow.com/a/41564507/5996106

标签: android firebase


【解决方案1】:

首先,您需要将Play Services Library 更新为rev.30:

然后你在这一行有一个小问题:

freeCompile 'com.google.firebase:firebase-ads:9.0.0:9.0.0'

您可能需要将其更正为:

freeCompile 'com.google.firebase:firebase-ads:9.0.0'

【讨论】:

  • 您还必须安装 Google 存储库。
  • 感谢您的帮助。我错过了播放服务。你对火力基地的修正也是正确的。官方文档好像有错误。
  • 我已经更新了我所有的库,但仍然出现错误。
  • 如何进入 SDK 管理器?我想我在 Android Studio 中查看它,但我的看起来非常不同。谷歌存储库也没有选项?!
猜你喜欢
  • 2016-11-12
  • 2017-04-19
  • 2016-09-15
  • 2017-03-04
  • 2016-09-19
  • 2016-09-15
  • 2017-02-19
  • 2018-11-26
  • 2019-02-16
相关资源
最近更新 更多