1、gradle 的仓库地址不安全警告
警告信息:
Using insecure protocols with repositories, without explicit opt-in, has been deprecated. This is scheduled to be removed in Gradle 7.0. Switch Maven repository 'm
aven(http://maven.aliyun.com/nexus/content/groups/public/)' to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/6.8.3/dsl/or
g.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
Configuration on demand is an incubating feature.
解决办法:使用 allowInsecureProtocol 属性
repositories {
...
maven {
allowInsecureProtocol = true
...
}
}
2、Android Gradle plugin requires Java 11
错误信息:
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
解决版本:
AGP 7.0.0-alpha02起需要使用Java 11
https://developers-jp.googleblog.com/2020/12/announcing-android-gradle-plugin.html
说明:AS Arctic Fox版本自带java 11
AndroidStudio > File > Setting >File | Settings | Build, Execution, Deployment > Build Tools >Gradle>Add JDK
选中 AS安装目录 下的 jre文件夹 即可。
3、依赖包下载失败问题
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.codersun:fingermanager:1.0.0.
Searched in the following locations:
解决方法:
添加jcenter()仓库,虽然提示过时,但是有些库还未从这里面迁移出来,还得继续使用;
repositories {
jcenter()
}