在以下位置搜索:

时间:2018-05-18 04:21:15

标签: android firebase build.gradle

找不到com.google.firebase:firebase-core:15.0.1。

在以下位置进行搜索:

file:/H:/sdk/extras/m2repository/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.pom
file:/H:/sdk/extras/m2repository/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.jar
file:/H:/sdk/extras/google/m2repository/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.pom
file:/H:/sdk/extras/google/m2repository/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.jar
file:/H:/sdk/extras/android/m2repository/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.pom
file:/H:/sdk/extras/android/m2repository/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.jar
https://jcenter.bintray.com/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.pom
https://jcenter.bintray.com/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.jar
https://maven.google.com/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.pom
https://maven.google.com/com/google/firebase/firebase-core/15.0.1/firebase-core-15.0.1.jar

要求:     项目:app

我已经检查了build.gradle两次,但无法找到任何解决方案。该库不在SDK目录(AndroidSDK)中,安装过程坚持该目录。我使用SDK Manager安装了Google存储库。在项目设置中,我有正确的SDK位置。如何强制AS查看正确的目录?

的build.gradle

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.demo.xxxxx"
            minSdkVersion 16
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        compile 'com.google.android.gms:play-services-auth:15.0.1'

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

根级Gradle

buildscript {

    repositories {
       // google()
        jcenter()
        maven { url "https://maven.google.com" }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.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 {
       // google()
        jcenter()
        maven { url "https://maven.google.com" }

    }
}

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

1 个答案:

答案 0 :(得分:0)

将您的根级别Gradle更新为:

buildscript {
    dependencies {
        // Other dependencies
        classpath 'com.google.gms:google-services:3.3.1' // google-services plugin
    }
}

还可以尝试将其添加到项目级别Gradle:

dependencies {
  // Other dependencies
  implementation 'com.google.firebase:firebase-core:15.0.2'
}

如果您收到“无法找到......?”'错误,然后尝试检查您的根 build.gradle 。 如果没有什么能让你好运,请尝试清理或重建你的项目。