Android Studio cannot download com.huawei.hms:push:4.0.2.300

Viewed 2390

When inheriting the push service, add Huawei Maven repository under buildscript and allprojects according to the document.

repositories {
    google()
    jcenter()
    maven {
        url 'http://developer.huawei.com/repo/'
    } // HUAWEI Maven repository
}

However, an error is reported during gradle synchronization.

Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine artifacts for com.huawei.hms:push:4.0.2.300
Could not get resource 'http://developer.huawei.com/repo/com/huawei/hms/push/4.0.2.300/push-4.0.2.300.aar'.
Could not HEAD 'https://developer.huawei.com/repo/com/huawei/hms/push/4.0.2.300/push-4.0.2.300.aar'.
server certificate change is restricted during renegotiation
4 Answers

you can try to change the URL from http to https

maven {
    url 'https://developer.huawei.com/repo/'
} // HUAWEI Maven repository

Check if your project level build.gradle looks like this

buildscript {
repositories {
    google()
    jcenter()
    maven {url 'http://developer.huawei.com/repo/' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:4.0.0'
    classpath 'com.huawei.agconnect:agcp:1.3.1.300'
    }
}
allprojects {
repositories {
    google()
    jcenter()
    maven {url 'http://developer.huawei.com/repo/' }
    }
}

Please make sure your network has no problems.

You can check if your AS can connect to huawei maven repo using proxy or not. Then you can know if it is the proxy that blocked you from linking to Huawei maven repo.You can disable the proxy and delete the gradle.properties file under .gradle directory. Then Sync again. Android Studio Check connection screenshots

Related