我们使用阿里镜像去下载库,升级到7.0时会出现以下错误:
opt-in, is unsupported. Switch Maven repository
'maven(http://maven.aliyun.com/nexus/content/groups/public/)' to redirect to a secure
protocol (like HTTPS) or allow insecure protocols.
解决办法:在项目的build.gradle中加入allowInsecureProtocol = true
,如下:
参考资料:
https://www.cnblogs.com/langkyeSir/p/14877709.html
报错信息:
No signature of method: build_6yelzgvzgvo56ckx44as1sptq.android() is applicable for argument types: (build_6yelzgvzgvo56ckx44as1sptq$_run_closure2) values: [build_6yelzgvzgvo56ckx44as1sptq$_run_closure2@1af01979]
在module的build.gradle中删除以下代码即可:
javaCompileOptions {
annotationProcessorOptions {
arguments = [fragmentArgsLogWarnings: 'false']
includeCompileClasspath true
}
}
参考资料:https://stackoverflow.com/questions/67418660/no-signature-of-method-android-is-applicable-for-argument-types-exception-i
这里是需要安装 jdk 11,在官网下载这个版本的jdk安装即可
报错信息:
A problem occurred evaluating project ':cachewebviewlib'.
> Failed to apply plugin 'com.android.internal.library'.
> 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`.
参考资料:http://nfail.com/q/39mEKy
AS每次打开的时候都会报出以下警告:
将上面出现的文件夹加入杀毒白名单即可。
我电脑上安装的是360,所以在360的白名单中加入之后,就没有再报了。
参考资料:
https://www.jmwww.net/file/10235.html
https://www.pianshen.com/article/71351202014/
## Project-wide Gradle settings.
#
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# 编译时使用守护进程
org.gradle.daemon=true
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# JVM最大允许分配的堆内存,按需分配
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# 使用并行编译
org.gradle.parallel=true
# 启用新的孵化模式
org.gradle.configureondemand=true
#
参考资料:https://blog.csdn.net/ccj659/article/details/51324389
在Terminal中输入graldew assembleRelease后,会报如下错误:
* What went wrong:
Execution failed for task ':xrecyclerview:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
> Android resource linking failed
ERROR:C:\Users\it21sj\.gradle\caches\transforms-3\a3e21b353ed623e8bb168c30ebae0d6d\transformed\appcompat-1.0.0\res\values-v28\values-v28.xml:5:5-8:13: AAPT: error: resource androi
d:attr/dialogCornerRadius not found.
ERROR:C:\Users\it21sj\.gradle\caches\transforms-3\a3e21b353ed623e8bb168c30ebae0d6d\transformed\appcompat-1.0.0\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource andro
id:attr/dialogCornerRadius not found.
ERROR:C:\Users\it21sj\.gradle\caches\transforms-3\1e404282fde982dcc25bc5f2e987f739\transformed\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/font
VariationSettings not found.
ERROR:C:\Users\it21sj\.gradle\caches\transforms-3\1e404282fde982dcc25bc5f2e987f739\transformed\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcI
ndex not found.
关键报错信息:AAPT: error: resource android:attr/ttcIndex not found.
出现这个问题的原因是,在一个项目中有module的 compileSdkVersion版本在28以下,将所有的module改为28及以上版本即可
参考资料:
https://www.jianshu.com/p/c8e1735bf72c
https://www.cnblogs.com/yunshangyue71/p/13424766.html
在执行Build→Rebuild Project的时候,会在build控制台出现以下报错信息
出现这种问题,点击Run with --info可以看到报错的详细信息,根据提示去修改。
我这里具体是集成buggly有问题,我将buglly更新、热更新全部删掉,重新集成后不会报错了。弄好了之后回头来看问题应该是下面截图位置的错误,将bugly的插件相关信息删除即可。
git上的仓库release之后在jitpack.io上发布的时候会报一下错误:
FAILURE: Build failed with an exception.
* Where:
Script '/script/maven-plugin.gradle' line: 2
* What went wrong:
A problem occurred evaluating script.
> Failed to apply plugin 'com.github.dcendents.android-maven'.
> Could not create plugin of type 'AndroidMavenPlugin'.
> Could not generate a decorated class for type AndroidMavenPlugin.
> org/gradle/api/publication/maven/internal/MavenPomMetaInfoProvider
解决办法,在对应的module的gradle.build文件里面增加以下配置
plugins {
...
id 'maven-publish'
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
groupId = 'com.petterp'
artifactId = 'statex'
version = '1.0-dev02'
}
}
}
}
然后在提交上去,重新发布即可。
部分项目还有可能碰到Java 11的问题,报错如下,请参阅资料里面有解决方法。
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
此错误参阅资料:
https://python.iitter.com/other/141094.html
https://www.aisoutu.com/a/934402