"Could not get resource" 安卓工作室同步错误



我想在Android Studio 3.2.1的项目中使用Google Firebase的ML工具包。然而,当我"将项目与Gradle文件同步"时,我可以看到Gradle未能获得一些依赖项,尽管这并不能阻止Gradle"成功"同步。所有这些依赖关系都与谷歌服务或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工具设置。你知道是什么原因导致了这个错误吗?提前谢谢!

编辑:就像这里描述的,我试图用命令行(gradlew-assemblyDebug(构建应用程序,我没有看到任何错误。这可能会奏效,我们拭目以待。

更改此

classpath 'com.google.gms:google-services:4.1.0'

到这个

classpath 'com.google.gms:google-services:4.2.0'

好吧,如果你用gradlew clean assemblyDebug每个命令行构建应用程序,这些错误看起来没有问题。至少人脸检测现在工作正常。

最新更新