- android studio编译警告:请使用 -Xlint:deprecation 重新编译
虽然不会对项目有什么影响,但是对于强迫症的人来说,还是很难受的;
既然提示我们使用–Xlint:deprecation重新编译,那我们只需要在build.gradle(Project:xxxxxxx)下找到allprojects标签,加入:
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "- Xlint:deprecation"
}
}
so,我的allprojects标签:
allprojects {
repositories {
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << “-Xlint:unchecked” << “-Xlint:deprecation”
}
}
}
本文介绍如何通过修改Gradle配置来消除Android Studio中的编译警告,特别是与废弃API使用相关的警告。通过简单的步骤,可以有效提升代码质量和编译体验。
3189

被折叠的 条评论
为什么被折叠?



