Android Studio Firebase快速入门构建失败

时间:2018-08-06 07:52:28

标签: android firebase android-studio

我从android开发开始,我尝试下载firebase快速入门,但是关于com.google.firebase:firebase-ml- *的构建失败

Failed to resolve: com.google.firebase:firebase-ml-common:16.1.2
Failed to resolve: com.google.firebase:firebase-ml-vision:17.0.0
Failed to resolve: com.google.firebase:firebase-ml-model-interpreter:16.2.0

我该如何理解错误所在,以纠正并构建此错误?任何一般性建议都欢迎,因为我才刚刚开始此android编程路径,谢谢。

根据我在其他类似文章中所读的内容,我认为build.gradle脚本是我需要展示的第一件事,所以:

buildscript {
    repositories {
        jcenter()
        mavenLocal()
        google()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.0.2'
    }
}

plugins {
    id 'com.github.ben-manes.versions' version '0.17.0'
}

allprojects {
    repositories {
        //mavenLocal() must be listed at the top to facilitate testing
        mavenLocal()
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
    }

    // See: https://github.com/ben-manes/gradle-versions-plugin
    dependencyUpdates.resolutionStrategy = {
        componentSelection { rules ->
            rules.all { selection ->
                boolean numbersOnly = (selection.candidate.version ==~ /^[\d.]+$/)
                if (!numbersOnly) {
                    selection.reject("Rejecting: ${selection.candidate.version}")
                }
            }
        }
    }
}

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

1 个答案:

答案 0 :(得分:0)

现在可以通过maven.google.com来获得播放服务和Firebase依赖项

替换此行maven { url 'https://maven.fabric.io/public' }

收件人:

 maven { url 'https://maven.google.com' }