0
votes

I want to use Google Firebase's ML-Kit for a project with Android Studio 3.2.1. However, when I "Sync the Project with Gradle Files", i can see that gradle is failing to get some of the dependencies, although this isn't preventing Gradle from syncing "succesfully". All of these dependencies are related to google-services or firebase. These are my build.gradle (app module) dependencies:

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'

and this is my top-level gradle:

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
}

I already checked the SDK Tools settings. Do you have any ideas what else could be causing this error? Thank you in advance!

EDIT: like discribed here, i tried to build the app with the commandline (gradlew assembleDebug), i don't see any errors. This may work, we'll see.

2
Try to move apply plugin: 'com.google.gms.google-services' at the top of file - Mikhail Sharin
Thank you for your help! Sadly, it didn't work :/ - Nils Krautkremer
stackoverflow.com/questions/53246632/… this looks same but hasn't answer - Mikhail Sharin
Jeah i've seen this post, but it was closed for no reason :// - Nils Krautkremer

2 Answers

0
votes

Change this

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

to this

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

Okay, it looks like these errors are no problem if you build the app with gradlew clean assembleDebug per commandline. Atleast facedetection works fine now.