Gradle 编译异常,找不到华为 push 的 sdk

1.由于华为在 jcenter 服务器上也发布了相关 sdk 但版本略有不同,请你将 project 的 build.gradle 中,华为maven依赖前置,配置如下:

allprojects {
    repositories {
        maven {url 'http://developer.huawei.com/repo/'}
        jcenter()
        mavenCentral()
    }
    buildscript{
        repositories {
            //Add Maven
            maven { url 'http://developer.huawei.com/repo/' }
        }
        dependencies {
            // Add this line
            classpath 'com.huawei.agconnect:agcp:1.4.1.300'
        }
    }

}

2.在 app 模块的 build.gradle 添加

dependencies {
      // Add this line
      implementation 'com.huawei.hms:push:4.0.2.300'
    }
    ...
    // Add to the bottom of the file
    apply plugin: 'com.huawei.agconnect'