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
1
vote
0 answers

Manifest unresolved class

I need to recognize if in my android manifest is some removed class (for exmaple activity) and fail build. Class is red with text "Unresolved class..." but build is successful. Lint is also OK. Is there any way to automatically detect this?
1
vote
0 answers

Lint to ensure method B is called after method A

Background: I am working on a resource extensive operation and reinitialising the object is too costly operation. So the current implementation involves following steps Initialisation -> Usage -> Cleanup Say my code is something like public class A…
Mohammed Atif
  • 4,383
  • 7
  • 28
  • 57
1
vote
0 answers

Android reusable layouts with background causing lint overdraw error

Our android application has a theme applied at application level and this theme contains the android:windowBackground attribute (white color). Now I am creating a reusable layout for a widget which will used in multiple screens. This widget also has…
ctor
  • 805
  • 1
  • 10
  • 26
1
vote
1 answer

Lint HTML/PDF report

I want HTML or PDF report for my android project, I've tried to generate HTML file following this tutorial, but its empty, while generating XML succeeds. Note: The following stack overflow issue was used as a tutorial: Exporting html report of…
Sarah
  • 177
  • 1
  • 1
  • 9
1
vote
1 answer

Why can't I suppress Android lint via comment

For some lint checks I can suppress them with a comment or a method annotation. ConstantConditions is a good example: However for other checks I can only suppress via a method annotation. CheckResult is an example. Is there any reason for this…
tir38
  • 9,810
  • 10
  • 64
  • 107
1
vote
0 answers

Android - conditional disable lint check when a specific annotation is present over a field

Since I cannot have the ButterKnife binded views to be private (ButterKnife itself denies it), I would like to avoid the lint check of "Declaration of access can be weaker" only when I have the ButterKnife annotation "BindView" over a field. In all…
Link 88
  • 553
  • 8
  • 27
1
vote
2 answers

Custom Lint Rules - JavaScanner @Deprecated

I would like to write some custom lint rules for my company android project. I was reading a few tutorials and successfully created a sample rule. Problem is that I was using a @Deprecated JavaScanner API. I was reading official google doc located…
Phate P
  • 1,572
  • 1
  • 22
  • 31
1
vote
1 answer

Android translation lint check - how to disable when only two out of 3 translations is required?

I have an app that usually translates into 3 different languages. Thai, indonesia and english (default). but on occasion i have a feature that is only applicable to thailand and english and indonesia does not need translations so i have left…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
1
vote
1 answer

gradle Lint plugin defined task for include or exclude custom files

I am using gradle lint plugin in my Android project on CI Server. But sometimes I want to run android lint only on custom files, just like gradle Copy Task include and exclude to defined task scope in my gradle task. In Android Studio, inspection…
1
vote
2 answers

Values in XML Attributes no longer accepted as valid after upgrading to Android Studio 3.0.1

After upgrading to Android Studio my styles.xml suddenly has lots of errors. When trying to change the parent property Android Studio suggests 'TextAppearance.Widget.AppCompat.Toolbar' as a valid value when typing... Also I had to prefix ?attr/...…
Ove Stoerholt
  • 3,843
  • 4
  • 25
  • 33
1
vote
0 answers

Run lint command from android studio terminal?

When I execute below command gradlew lint I am facing this error: Starting a Gradle Daemon, 1 incompatible and 8 stopped Daemons could not be reused, use --status for details FAILURE: Build failed with an exception. What went wrong: Unable to…
kodali
  • 297
  • 1
  • 4
  • 19
1
vote
1 answer

Android Studio lint highlight with Timber not working

I've integrated Timber into a new project. And I cannot make the lint highlight to work. Meaning stuff like this: Timber.i("Hello, " + "world!"); Isn't highlighted to yellow. Am I missing something? Is there a setting for this? Running a…
a_dzik
  • 927
  • 2
  • 11
  • 24
1
vote
1 answer

Using NewApi property still causes lint warnings

I have created my own extension function that checks if the sdk is at least lollipop inline val buildIsLollipopAndUp: Boolean get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP However, if I use this, the lint tools can't figure out…
Allan W
  • 2,791
  • 4
  • 23
  • 41
1
vote
1 answer

custom lint Android-Studio-tooltip not showing explanation

I am writing custom lint rules, which should be shown in Android Studio. Everything is working fine except if i click on the "more..." link to see further explanation for the lint error. It always says "Under construction". I don't know why, is this…
Leonard Arnold
  • 646
  • 3
  • 14
1
vote
1 answer

How do you add lint rule exceptions for java modules / relative paths in Android?

I have an Android project that has the typical myproject/app/ directory along with another separate java module myproject/mymodule/. How do I add exceptions for mymodule? Using relative paths in app/lint.xml doesn't seem to work.
loeschg
  • 29,961
  • 26
  • 97
  • 150