How to detect deprecated androidx.legacy.widget.Space class?

Viewed 1465

Context

I am using the androidx.legacy.widget.Space in a layout in an Android application project:

<androidx.legacy.widget.Space
    android:layout_width="match_parent"
    android:layout_height="@dimen/space_height" />

The class is marked as @Deprecated - one should use the framework Space class instead:

// Copied from legacy-support-core-ui-1.0.0-sources.jar/androidx/legacy/widget/Space.java
@deprecated Use framework {@link android.widget.Space} class instead.

Finding usage of deprecated APIs

I ran Inspect Code... or Run inspection by Name ... for Java or XML files (see screenshots) in Android Studio 4.2 Canary 7 ...

Deprecated API usage (Java | Code maturity)

Deprecated API usage in XML

... and use the compiler arguments when I build via shell command ..

options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"

... but the deprecated Space class usage is not reported. How can I detect it (and any other such cases)?

Update 27.08.2020

In Android Studio both the "Deprecated API usage ..." Inspections for Java and XML are activated as shown in the Setting screenshot.

Deprecated API usage

Related

1 Answers

Searching for Deprecated API Usage in XML by clicking Analyze -> Run Inspectinon By Name ->type Deprecated API Usage should fetch all the deprecated instances in XML files. Could you paste the screenshot of your results returned by searching by name?
Or try this Manually Run Inspections by setting scope as whole project. This will also fetch the deprecated instances. For Java classes search for Java->Code Maturity->Deprecated API usage. and for XML search for XML->Deprecated API usage in XML.
Last option is to search androidx.legacy.widget.Space in Find in path. Press Ctrl+Shift+F and search for androidx.legacy.widget.Spacethroughout project or you could even add a file mask such as only xml.

Related