am_*_*nix 56 android gradle android-studio build.gradle
当我尝试使用gradle使用此命令构建一个android项目时:
> gradlew clean build assembleRelease
Run Code Online (Sandbox Code Playgroud)
它给了我这个错误:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Run Code Online (Sandbox Code Playgroud)
我可以构建这个项目并在Studio中制作APK.
有没有办法配置Gradle进行编译忽略Xlint通知?
或者,我可以使用其他参数,使用gradle/gradlew从命令行发布吗?
sha*_*aca 85
这是一个很好的警告,而不是错误.要查看完整的lint报告,您可以将这些行添加到build.gradle:
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
Run Code Online (Sandbox Code Playgroud)
如果你真的想摆脱这些警告:
Spa*_*man 38
从@shakalaca的答案中可以看出这一点,但是如果你的代码足够老以获得弃用警告,那么你可能还有足够长的代码来使用未经检查的操作,例如List没有参数化类型的代码List<String>.这会给你一个额外的警告:
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Run Code Online (Sandbox Code Playgroud)
您可以只展开编译器args块以包含它:
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
33608 次 |
| 最近记录: |