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
10
votes
2 answers

Using Twitter4j in android, getting lint error in library - Invalid package reference in library

I am using twitter4j in an android app for using twitter API. Everything works fine, and I have no problem with the library. Today I ran lint and getting lint errors in the twitter4j-core-3.0.3.jar. I dont have control over this third party…
Gaurav Vashisth
  • 7,547
  • 8
  • 35
  • 56
10
votes
3 answers

Fatal Lint Error during exporting of signed app

I'm trying to export a signed android app, but I encountered this lint error: And when I go into the xml to look at it, this happens: Is there a way to solve this so that I can continue to sign the app? I don't need them translated since it'll all…
lyk
  • 1,578
  • 5
  • 25
  • 49
9
votes
4 answers

Lint for android in Eclipse gives wrong results

If I run "lint ." inside project directory I get the expected warnings, but if I run it from inside eclipse I get nonsense errors and warnings, for example: The resource R.array.settings_derivatives appears to be unused [in fact, it is used] The …
miniBill
  • 1,743
  • 17
  • 41
9
votes
1 answer

What is the correct way to do BigDecimal comparison

Since recently, (I think it's since I converted my code to kotlin but not sure), Android Studio show me a warning when I write if (myValue.compareTo(BigDecimal.ZERO) > 0) The message say "Call replaceable with binary operator" and replace my code…
Bencri
  • 1,173
  • 1
  • 7
  • 22
9
votes
1 answer

Best usage of SuppressWarnings Unused in library

I'm developing an Android library and I wanted to clean all warnings. Most of them is due to unused methods. I don't want to remove this methods from the class as it could be used by other developer. Should I: add @SuppressWarnings("unused") on…
Hugo Gresse
  • 17,195
  • 9
  • 77
  • 119
8
votes
2 answers

Android Studio lint_baseline.xml does not exclude many issues that it should

I have this in my build.gradle: android { lintOptions { abortOnError false absolutePaths false lintConfig file('lint.xml') baseline file('lint-baseline.xml') } } And I have run Analyze > Inspect Code previously to establish this…
Jeff Johnson
  • 123
  • 1
  • 6
8
votes
2 answers

Is constructor of private inner class also private?

I'm refactoring an android project which is getting to big. Running lint gives me the JSME issue Private member access between outer and inner classes. Considering the following example public class Outer { private Inner mInner = new Inner(); …
tynn
  • 38,113
  • 8
  • 108
  • 143
8
votes
1 answer

How can i lint only one product flavor?

Problem: When I execute gradle lint it lint both product flavors. One is not ready, so it fails always (not all the strings are there). What i want: I really want some option to say lint only this product flavor
8
votes
2 answers

How to re-enable a disabled Android Lint warning on file level

I disabled the Android Lint warning 'HardcodedText' for a specific XML file (it's for a numeric key pad with fix text for the digits). I can't find a way to re-enable it on this file ('Restore Defaults' or so), neither in Windows > Preferences >…
infero
  • 843
  • 2
  • 11
  • 22
7
votes
1 answer

After update AGP to 4.2.2 from 4.1.3 - get error "Execution failed for task ':app:lintVitalProductionRelease' "

besides AGP update, updated compileSdkVersion and targetSdkVersion to 30. build success, if set lintOptions { checkReleaseBuilds false } else i get Execution failed for task ‘:app:lintVitalProductionRelease’. > Could not resolve all…
Alexandr
  • 101
  • 2
7
votes
2 answers

“Obsolete custom lint check” from `androidx.appcompat.AppCompatIssueRegistry` which requires a newer API level

I’ve got a project in which I get the following Android lint warning: Obsolete custom lint check ../../../../../../../.gradle/caches/transforms-2/files-2.1/fc4398fa701898f50fcec85691d33578/appcompat-1.2.0/jars/lint.jar: Lint found an issue registry…
mirabilos
  • 5,123
  • 2
  • 46
  • 72
7
votes
2 answers

How to make Android Studio build fail on lint errors

Is it possible to make Android Studio build fail on lint check errors ? I have problems with ImageViews when I convert icon from .png to vector drawable .xml Sometimes I forgot to…
Stanislaw Baranski
  • 1,308
  • 9
  • 18
7
votes
0 answers

SearchView.clearFocus can only be called from within the same library group (groupId=com.android.support)

I have a searchview defined in an activity as follows: import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.SearchView; public class SearchActivity extends AppCompatActivity { @BindView(R.id.search_view) SearchView…
blizzard
  • 5,275
  • 2
  • 34
  • 48
7
votes
1 answer

How to enable lint error in Android Studio for message "Call requires API level 21 (current min is 16)"?

I have a method called setImageTintList() that requires min API to be 21. But, if I set my min API to 16 in gradle, the app still builds without any warning. Although there is a red line saying: setImageTintList() - Call requires API level 21…
7
votes
2 answers

How to disable 'contentDescription' warning on gradle with lintOptions?

I would like to disable this warning: [Accessibility] Missing 'contentDescription' attribute on image I know the solution android:contentDescription:"@null". But I want to be able to do the entire project and not on each of my ImageView. On…
lopez.mikhael
  • 9,943
  • 19
  • 67
  • 110