1
當我使用gradle構建項目時,我無法看到有關棄用方法的任何警告,只顯示錯誤。如何在gradle中啓用棄用方法警告
如何設置build.gradle以顯示所有deprecations警告(而不阻止構建完成)?
當我使用gradle構建項目時,我無法看到有關棄用方法的任何警告,只顯示錯誤。如何在gradle中啓用棄用方法警告
如何設置build.gradle以顯示所有deprecations警告(而不阻止構建完成)?
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
,你可以把你的頂級的build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
或你的模塊之一:
apply plugin: 'com.android.application'
android {
...
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
這是行不通的。 (似乎僅與java xlint警告相關) – AndreaF
當我運行gradle任務'gradle app:build'時,我可以清楚地看到:警告:[已棄用] ***中的***()已被棄用 – Gut
可以發佈完整你使用的build.gradle文件? – AndreaF