是否可以使用 Android Studio lint 工具获取详细信息?
Is it possible to get details with the Android Studio lint tool?
我使用 lint 检查一个 Android 应用程序项目:
gradlew lint
显示如下:
> Task :app:compileOfficialDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
该过程生成两个文件:lint-results.html 和 lint-results.xml。我检查了这两个文件,但找不到任何与弃用 API 有关的信息。是否可以在这两个文件中生成有关已弃用 API 的更多详细信息?
这是一个例子"build.gradle"我标记了:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
multiDexEnabled true
applicationId "com.boxpik.android"
minSdkVersion 17
targetSdkVersion 19
...
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
...
在这个例子中,我将 options.compilerArgs << "-Xlint:all"
添加到 build.gradle
。
这在我的 Android Studio "Build" window:
中给了我一堆 Lint 警告
^
C:\xyz\PoolToScoreDetailFragment.java:55: warning: [deprecation] ProgressDialog in android.app has been deprecated
private ProgressDialog pDialog;
^
C:\xyz\PoolToScoreDetailFragment.java:346: warning: [deprecation] ProgressDialog in android.app has been deprecated
pDialog = new ProgressDialog(application);
我使用 lint 检查一个 Android 应用程序项目:
gradlew lint
显示如下:
> Task :app:compileOfficialDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
该过程生成两个文件:lint-results.html 和 lint-results.xml。我检查了这两个文件,但找不到任何与弃用 API 有关的信息。是否可以在这两个文件中生成有关已弃用 API 的更多详细信息?
这是一个例子"build.gradle"我标记了:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
multiDexEnabled true
applicationId "com.boxpik.android"
minSdkVersion 17
targetSdkVersion 19
...
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
...
在这个例子中,我将 options.compilerArgs << "-Xlint:all"
添加到 build.gradle
。
这在我的 Android Studio "Build" window:
中给了我一堆 Lint 警告 ^
C:\xyz\PoolToScoreDetailFragment.java:55: warning: [deprecation] ProgressDialog in android.app has been deprecated
private ProgressDialog pDialog;
^
C:\xyz\PoolToScoreDetailFragment.java:346: warning: [deprecation] ProgressDialog in android.app has been deprecated
pDialog = new ProgressDialog(application);