Questions tagged [android-lint]

Android Lint is a tool in ADT which scans Android project sources for potential bugs.

Android Lint is a tool in which scans project sources for potential bugs. It is available both as a command line tool, as well as integrated with .

Here are some examples of the types of errors that it looks for:

  • Missing translations (and unused translations)
  • Layout performance problems (all the issues the old layoutopt tool used to find, and more)
  • Unused resources
  • Inconsistent array sizes (when arrays are defined in multiple configurations)
  • Accessibility and internationalization problems (hardcoded strings, missing contentDescription, etc)
  • Icon problems (like missing densities, duplicate icons, wrong sizes, etc)
  • Usability problems (like not specifying an input type on a text field)
  • Manifest errors

and many more.

336 questions
5
votes
1 answer

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

Context I am using the androidx.legacy.widget.Space in a layout in an Android application project: The class is marked as…
JJD
  • 50,076
  • 60
  • 203
  • 339
5
votes
1 answer

Execution failed for JetifyTransform with android.tools.lint

Project build.gradle: buildscript { ext.kotlin_version = '1.3.72' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.6.3' classpath…
GuilhE
  • 11,591
  • 16
  • 75
  • 116
5
votes
1 answer

Collect specific classes before running lint detector

I want to write a lint check to ensure that @ContributesAndroidInjector was added to all fragments that need it. Is there a way to gather all classes that are annotated with @Module before visitClass(node: UClass) is called? Now I have manually…
Martynas Jurkus
  • 9,231
  • 13
  • 59
  • 101
5
votes
1 answer

Running gradlew lint on specific file(s)

I'm trying to create pre-commit hook with code style check and other errors. It's a multi-module project in Android Studio (java and kotlin). I was hoping to use lint, but no luck. My condition is to check only new and modified files (baseline is in…
Majkeee
  • 960
  • 1
  • 8
  • 28
5
votes
2 answers

How to force relative paths in Android Lint baseline

I'm attempting to create a baseline lint file for my Android project. I've got a block set up in my main module's build.gradle: lintOptions { baseline file("lint-baseline.xml") checkAllWarnings true …
karl
  • 3,544
  • 3
  • 30
  • 46
5
votes
0 answers

Suppress "WeakerAccess" lint warning on field annotated with @BindView

Naturally, ButterKnife fields cannot be declared as private despite of Android Lint not knowing this. However, instead of all my fields looking like this: @SuppressWarnings("WeakerAccess") @BindView(R.id.foo) Bar mFoo; I prefer the more clean…
Thijs
  • 714
  • 9
  • 23
5
votes
2 answers

Lint error fixing

I am getting lint error in android studio as Error:Execution failed for task ':app:lint'. Lint found errors in the project; aborting build. Fix the issues identified by lint, or add the following to your build script to proceed with…
Madhukar Hebbar
  • 3,113
  • 5
  • 41
  • 69
5
votes
3 answers

Sonar Android Lint no matching issues found

I have got the following trouble: I have installed SonarQube and Android Plugin with "Android Lint" Quality Profile. When I execute my build.gradle script with "Android Lint" profile, sonar-runner plugin works good, but in SonarQube I can see no…
Vladimir Voitekhovski
  • 1,472
  • 5
  • 21
  • 33
5
votes
1 answer

Android Lint: How to suppress all warnings associated with support library?

I am trying to use Android Lint to keep my code running smoothly but since I'm using support-v7-appcompat, Lint returns an enormous, overflowing list of warnings. How can I suppress all of them so I can only see issues with my own app? In the Lint…
Blake
  • 695
  • 9
  • 23
5
votes
2 answers

Custom Lint Rule: how to handle fix button click

I followed this tutorial and it worked perfect for me. Now I want to add fix issue functionality. I am using Eclipse. In Lint Warnings view we have Fix button, can I handle it? For example when we have hard coded string (android:text="Test") in…
Dmytro Danylyk
  • 19,684
  • 11
  • 62
  • 68
5
votes
3 answers

Android Eclipse Lint API checks

Thanks P.T. for what looks like the correct answer to question Building multi-SDK Android apps in Eclipse without losing compile-time checks. However, when I try to use the @TargetApi() annotation as recommended, it generates syntax…
Dave
  • 3,834
  • 2
  • 29
  • 44
5
votes
6 answers

LinearLayout or its LinearLayout parent is useless , Can i ignore the warning message?

I face the nest layout problems and throws some exceptions. The error is "This LinearLayout layout or its LinearLayout parent is useless ...". I know i can ignore it this warning by this setting. Setting: Build Path->Configure Build Path.... Under…
5
votes
1 answer

Erroneously used mixed-case package-name on an already deployed App, can I change it to lowercase?

I have an app on Google Play whose java package name has the last part in mixed-case.. I was looking to remove an Android Lint warning (see this question) and Jens made me notice that Java naming conventions say that you should use only lowercase…
4
votes
1 answer

When i update my ADT plugin for Android i get run android lint ,what are adavantages of it to use it for android project?

Every One Here When i update my ADT plugin to ADT 16 i get One new (Tool)thing which is run android Lint when i run it after select my android project it give me more 550 warning related to project for android .should i have to follow advise by…
Herry
  • 7,037
  • 7
  • 50
  • 80
4
votes
2 answers

Android Lint Doesn't Show Translation Missing Errors

I am using Android SDK 16.1 with Eclipse on Windows. I've set ANDROID_LINT_COMPLETE_REGIONS as a Windows environment variable per the documentation I've rebooted my computer. I've verified the System.getenv("ANDROID_LINT_COMPLETE_REGIONS") uses…
Justin
  • 874
  • 8
  • 15