【发布时间】:2018-12-05 13:07:32
【问题描述】:
我想将 Google Firebase 的 ML-Kit 用于带有 Android Studio 3.2.1 的项目。但是,当我“将项目与 Gradle 文件同步”时,我可以 see 表示 gradle 无法获取某些依赖项,尽管这并不能阻止 Gradle“成功”同步。所有这些依赖项都与 google-services 或 firebase 有关。 这些是我的 build.gradle(应用程序模块)依赖项:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-ml-vision:18.0.2'
implementation 'com.google.firebase:firebase-ml-common:16.1.6'
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'
}
apply plugin: 'com.google.gms.google-services'
这是我的顶级毕业生:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.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
}
我已经检查了SDK Tools settings。 您有什么想法可能导致此错误吗? 提前谢谢!
编辑:如here 所述,我尝试使用命令行(gradlew assembleDebug)构建应用程序,但没有看到任何错误。这可能会奏效,我们拭目以待。
【问题讨论】:
-
尝试将应用插件:'com.google.gms.google-services'移到文件顶部
-
感谢您的帮助!可悲的是,它没有用:/
-
stackoverflow.com/questions/53246632/… 这看起来一样,但没有回答
-
我看过这篇文章,但它无缘无故关闭了://
标签: android firebase android-studio gradle firebase-realtime-database