报错原因,未引用maven库
于是在build.gradle里加
allprojects {
repositories {
...
}
}
还是不对,最后查阅了资料
最新得放在setting.gradle当中
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
所以把maven库加在此处即可