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
314
votes
8 answers

This Handler class should be static or leaks might occur: IncomingHandler

I'm developing an Android 2.3.3 application with a service. I have this inside that service to communicate with Main activity: public class UDPListenerService extends Service { private static final String TAG = "UDPListenerService"; …
VansFannel
  • 45,055
  • 107
  • 359
  • 626
295
votes
5 answers

What is "android:allowBackup"?

Since the new ADT preview version (version 21), they have a new lint warning that tells me the next thing on the manifest file (in the application tag): Should explicitly set android:allowBackup to true or false (it's true by default, and that can…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
228
votes
3 answers

How does setting baselineAligned to false improve performance in LinearLayout?

I was just building some UI in xml, and Lint gave me a warning and said to set android:baselineAligned to false to improve performance in ListView. The docs for the Lint changes that added this warning say Layout performance: Finds LinearLayouts…
Christopher Perry
  • 38,891
  • 43
  • 145
  • 187
189
votes
13 answers

Lint: How to ignore " is not translated in " errors?

I can't compile/debug our Android app, because the localization files are not perfect yet. My IDE's validation tool Lint create errors saying: newCardsOrderVals is not translated in ar, bg, ca, cs Compiling/installing/running with Ant works fine,…
149
votes
4 answers

Missing support for Firebase App Indexing (android lint)

I receive this lint warning when analysing my code (Analyse > Inspect Codes) on Android studios. App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent-filler. See issue explanation for more…
136
votes
11 answers

Android Lint contentDescription warning

I am getting warning as "[Accessibility] Missing contentDescription attribute on image" for imageview. while using android lint What does that mean?
MGK
  • 7,050
  • 6
  • 34
  • 41
127
votes
11 answers

Avoid Android Lint complains about not-translated string

is it possible to specify that the strings in a file within the value-* directories are purposely not translated into other languages? I have a bunch of strings that are common for all the languages and need no translation, so I've created an…
Gianni Costanzi
  • 6,054
  • 11
  • 48
  • 74
123
votes
3 answers

AppCompatActivity.onCreate can only be called from within the same library group

After upgrading to appcompat 25.1.0 I've started getting weird errors. In my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); I get lint error: AppCompatActivity.onCreate can only be…
pixel
  • 24,905
  • 36
  • 149
  • 251
79
votes
5 answers

Why is 0dp considered a performance enhancement?

An answer at the end of this question has been filled out, combining remarks and solutions. Question I searched around but haven't found anything that really explains why Android Lint as well as some Eclipse hints suggest replacing some…
Kirk
  • 16,182
  • 20
  • 80
  • 112
78
votes
4 answers

How Do We Configure Android Studio to Run Its Lint on Every Build?

Once upon a time, particularly in Eclipse-land, Lint would run on every build, and so if you failed Lint checks, you would find out immediately. With Android Studio (tested on 1.3), Lint does not run by default on a build. Newcomers might make…
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
74
votes
4 answers

Why does Android Lint warn about String.format using default locale when explicitly using Locale.US?

I originally called String.format this way: return String.format("%s %f %f", anotherString, doubleA, doubleB); Which made Android Lint generate this warning: Implicitly using the default locale is a common source of bugs: Use String.format(Locale,…
Nobody Special
  • 1,255
  • 1
  • 10
  • 14
55
votes
6 answers

Suppress "Identifier not allowed in Android"

For my application written in Kotlin I use backticked method names for tests, like this: fun `API login error - don't save token or user`() { It works, the tests compile and work without a problem, but Lint in Android Studio is marking those…
Michał Klimczak
  • 12,674
  • 8
  • 66
  • 99
50
votes
8 answers

Run lint when building android studio projects

I would like to be able to run the lint task when I'm building projects with the android studio to ensure the lint rules are being followed. I have tried using task dependencies but with no luck. My TeamCity build server uses the build task which…
Robert
  • 6,086
  • 19
  • 59
  • 84
50
votes
9 answers

Android Lint: how to ignore missing translation warnings in a regional locale string file that purposely only overrides some default translations?

Is it possible to translate some strings, but not all, in a separate resource file without Lint complaining about MissingTranslation? For example: my app's strings are all in res/values/strings.xml. One of the strings is
Steveo
  • 2,238
  • 1
  • 21
  • 34
46
votes
2 answers

How to address android lint complaint about exported Firebase Messaging service implementations?

Following the Google developer instructions on implementing Firebase in my app, I notice that android lint complains. The idea is that we have to implement two services which inherit from Firebase services: public class MyFirebaseInstanceIDService…
1
2 3
22 23