gpt4 book ai didi

android - 如何添加-Xlint :unchecked to my Android Gradle based project?

转载 作者:IT老高 更新时间:2023-10-28 13:00:23 29 4
gpt4 key购买 nike

我尝试将以下内容添加到根 build.gradle 文件中:

subprojects {
gradle.projectsEvaluated {
tasks.withType(Compile) {
options.compilerArgs << "-Xlint:unchecked -Xlint:deprecation"
}
}
}

但我明白了:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Libraries:ActionBarSherlock:compileRelease'.
> invalid flag: -Xlint:unchecked -Xlint:deprecation

我做错了什么?

最佳答案

这对我有用:(在您项目的 build.gradle 中)

allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}

关于android - 如何添加-Xlint :unchecked to my Android Gradle based project?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18689365/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com