0

In an empty project(create from new project),Android Studio can not detect lint issue "UnusedAttribute", neither code editor display hint or run Ananlyze manually(the item is checked).

And there is no lint.xml or lint config in build.gradle file in project.

android studio screenshot

my code is

<TextView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    android:paddingHorizontal="52dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

android:paddingHorizontal is introduced in version 26, and my minSdkVersion is 16.

Also, command line

./gradlew :app:lintDebug

output:lint-results-debug.html also show no detect "UnusedAttribute" problem.

I think it is my env or ide problem, but do not know what is it. Anyone have this problem?

Additional information:

I want a clean project to figure out this problem and create empty project. In my production project Android studio also can not detect android:paddingHorizontal issue, but can detect android:networkSecurityConfig, and command line output is here:

lint-results-debug.html screenshot

  • Did you try Invalidate Caches / Restart in Android Studio? – Razvan S. Jun 10 '20 at 12:13
  • @RazvanS. Just tried, nothing happened. – dagwood yu Jun 10 '20 at 12:21
  • add code to module build.gradle ```lintOptions { // disable 'PxUsage', 'SpUsage', 'UnusedAttribute' enable 'PxUsage', 'SpUsage', 'UnusedAttribute' }``` **PxUsage** and **SpUsage** can be turned on or off, but **UnusedAttribute(paddingHorizontal attribute)** not be detected. – dagwood yu Jun 10 '20 at 12:27
  • It is like that configuration somewhere override the enable config, but not sure. – dagwood yu Jun 10 '20 at 12:42

0 Answers0