Is it possible to get details with the Android Studio lint tool?

251 views Asked by At

I use lint to check an Android app project:

gradlew lint

It shows the following:

> Task :app:compileOfficialDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

The process generates two files: lint-results.html and lint-results.xml. I checked both files, but could not find any information related to deprecated API. Is it possible to generate more details about deprecated API in these two files?

1

There are 1 answers

3
paulsm4 On BEST ANSWER

Here's an example "build.gradle" I marked up:

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'
    })
...

In this example, I added options.compilerArgs << "-Xlint:all" to build.gradle.

This gave me a bunch of Lint warning in my Android Studio "Build" window:

                          ^
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);