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
3
votes
0 answers

Is There a Lint Rule to Enforce android:screenOrientation Values?

I am working on a project where the client wants all activities locked to portrait orientation. The project is using a multi-activity architecture, so from time to time we add new activities to the manifest. And, on occasion, an activity gets added…
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
3
votes
3 answers

Android custom lint rule does not detect any issue (for imports)

I am applying the lint project as follows to a app module where there are issues but non of the issues are detected. lintChecks project(':customlint') ImportsIssueRegistry.kt class ImportsIssueRegistry : IssueRegistry() { override val issues:…
user158
  • 12,852
  • 7
  • 62
  • 94
3
votes
1 answer

How to output deprecation warnings for Kotlin code?

I am using the following configuration snippet in my Java/Kotlin Android project in the app/build.gradle file: gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" …
JJD
  • 50,076
  • 60
  • 203
  • 339
3
votes
0 answers

Lint error "ImpliedQuantity" when wrapping plurals item in CDATA

Seems like the ImpliedQuantity lint check triggers a false positive when plural items are wrapped in CDATA. For example, having these resources in the French strings.xml: %d…
saschoar
  • 8,150
  • 5
  • 43
  • 46
3
votes
0 answers

Android: find unused string resources taking into account generated binding classes

I cannot believe after searching for hours I have not found a reliable solution that will report all truly unused string resources in my android project. Android Lint does not work because it ignores references to string resources from code in…
Farrukh Najmi
  • 5,055
  • 3
  • 35
  • 54
3
votes
2 answers

Lint error when upgrading to gradle plugin 3.0 : Missing layout_width or layout_height attributes

In the process of updating to android gradle plugin 3.0, lint has suddenly started failing for views where layout_width and layout_height are defined in the style, rather than at the parent layout. One of the examples :
3
votes
2 answers

How to correctly implement and test Custom Lint Rules in Android Studio?

I'm following this tutorial and this Custom Detector Example in order to implement Custom Lint Rules. Basically what I've done is: Create a new Android Project in Android Studio; Create a java module for project created in step 1; On module's…
Humble Student
  • 3,755
  • 4
  • 20
  • 35
3
votes
1 answer

How can I run Android Lint on non-android modules?

How can I run gradlew lintDebug on both the Android app and the Java module? Here is an example project setup: root-project |- android-app |- java-library Here is what I have done so far: gradle.taskGraph.whenReady { taskGraph -> if…
Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
3
votes
2 answers

Can I ignore "Incompatible Gradle Versions" lint check if Gradle overrides transtivie dependencies?

I just violated this lint check: Incompatible Gradle Versions ../../build.gradle: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.1, 25.2.0.…
tir38
  • 9,810
  • 10
  • 64
  • 107
3
votes
2 answers

Customize lint warnings for deprecation/newapi

i just wanna know if there is the possibility to customize the lint checks for the following case: Spannable text; if(Build.VERSION.SDK_INT > Build.VERSION_CODE.N) { text = Html.fromHtml(htmlString, Html.FROM_HTML_MODE_LEGACY, null, null); } else…
3
votes
0 answers

JavaPsiScanner doesn't see calls

I'm working on a custom Lint check and can't get all the method calls I need. What I need: access to every add() call in lines like this: Builder.from(arg) .add(arg1, arg2) .add(arg1, arg2) .add(arg1, arg2); What I get:…
ab.helly
  • 517
  • 1
  • 5
  • 21
3
votes
1 answer

Android Lint warning: "Redundant array creation for calling varargs method"

I am getting the above Lint warning in my Android project for the new Void[] {} part of the following code: new AsyncTask() { @Override protected void onPreExecute() { showToast("Restarting NFC..."); } …
ban-geoengineering
  • 18,324
  • 27
  • 171
  • 253
3
votes
2 answers

Problems using String resources (strings.xml) with parameters

I'm using strings with parameters, like this: My Android device has reached %1$s points in the app: https://play.google.com/store/apps/details?id=%2$s String s = getString(R.string.share_1,…
NullPointerException
  • 36,107
  • 79
  • 222
  • 382
3
votes
3 answers

Gradle clean fails because of lint & timber

Using Android Studio 1.5.1 on Windows 7, and gradle 2.8 or 2.10, I got the following error when trying to run a gradle clean (only when using Timber): gradle clean Incremental java compilation is an incubating feature. …
Crachou
  • 53
  • 6
3
votes
0 answers

Current status of Android Lint option 'MissingPermission'

I'm looking for a quick way to identify missing Android permissions. According to Android Tools Project Site here: http://tools.android.com/tips/lint-checks, Android Studio 1.4 is able to check MissingPermission: MissingPermission Priority: 9 / 10…
Song
  • 504
  • 7
  • 17