androidandroid-studioandroid-gradle-plugingoogle-visionfirebase-mlkit

Could not determine artifacts for com.google.android.gms:play-services-vision:18.0.0


I'm not able to build my project in Android Studio. I'm trying to use the google vision API for face detection and it worked fine so far, but I can't clean/ build my project because of this

This is my build error message

Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine artifacts for com.google.android.gms:play-services-vision:18.0.0
Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-vision/18.0.0/play-services-vision-18.0.0.aar'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-vision/18.0.0/play-services-vision-18.0.0.aar'.
Remote host closed connection during handshake
SSL peer shut down incorrectly

This my build.gradle file (app level)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"
    defaultConfig {
        applicationId "com.example.facedetect"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.volley:volley:1.1.1'
    implementation "com.github.bumptech.glide:glide:4.9.0"
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    implementation 'com.google.android.gms:play-services-vision:18.0.0'


    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.mindorks:paracamera:0.2.2'
}
apply plugin: 'com.google.gms.google-services'

Project level build.gradle

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'

    }
}

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

    }
}

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

buildscript {

    dependencies {
        // Add this line
        classpath 'com.google.gms:google-services:4.3.0'
    }

}

When I remove the

implementation 'com.google.android.gms:play-services-vision:18.0.0

The project build succeeds. Is something wrong with the way I'm adding the dependency?


Solution

  • I figured it out. Looks like I needed to invalidate caches and restart both android studio and my computer. Thanks for the help!