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
0
votes
1 answer

AndroidLint default rules location

I'm trying to learn more about android lints. So I want to see already implemented rules. I searched a lot but I couldn't find the location of these files. Can someone give me the location or link to access these files?
Saman Sattari
  • 3,322
  • 6
  • 30
  • 46
0
votes
1 answer

Need to check sub class (of Class type) if it inherits from super class, using custom Detector via method visitCallExpression(UCallExpression)

I have created my own lint Detector.visitCallExpression(UCallExpression) and I need to find a way to check if a MyClass class parameter passed into a method call is a child of MyParent class? //Example having this below code somewhere to be Lint…
Cozytrony
  • 1
  • 1
0
votes
0 answers

In android, Can we use conditions to make sure that developer always writes unit test?

In android, how can I make sure that developers always write unit test of each method they wrote? Is there a lint or klint library or custom code to check that, for example If i have written a function, lint should ask in warning that if you have…
Ahmad Shahwaiz
  • 1,432
  • 1
  • 17
  • 35
0
votes
0 answers

How can I get the name of the function within which something is being called in an Android lint check?

I'm writing a lint check to flag code that is calling a specific function from within a click listener on an Android view. For example: // case 1 button.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { …
howettl
  • 12,419
  • 13
  • 56
  • 91
0
votes
1 answer

Lint tags project_id generated by google services plugin as UnusedResource

As described here, the Google Services Plugin generates XML files that can be referenced in code. My problem is that when running the lintRelease task for my Android project, lint tags a resource found in one of the XMLs generated by the said plugin…
Alvin Dizon
  • 1,855
  • 14
  • 34
0
votes
1 answer

How to share Android lintOptions across modules

I am building a multi-module app and in each module I have lint settings as follows android { ... lintOptions { quiet true abortOnError false warningsAsErrors true } ... } It is tedious to repeat such settings…
H.Nguyen
  • 1,621
  • 5
  • 19
  • 31
0
votes
0 answers

Android Lint: Is it possible to publish a lint check in a jar file (not aar) on Maven

I've made a lint check, simple java-only (kotlin) module, put it in a jar file and I plan to upload it to Maven Central as a jar. I started with publishing to maven local for test. I put the required Lint-Registry-v2 in jar's manifest and I'm…
dimsuz
  • 8,969
  • 8
  • 54
  • 88
0
votes
1 answer

Have different Android lintOptions for different gradle tasks

I want to run the Android Lint both locally (IDE) and on the CI. I have a task like this, which I want the abortOnError as true when run on CI but false when ran locally. task lintCI { outputs.upToDateWhen { false } subprojects.each { project -> …
0
votes
1 answer

How to check if kotlin attribute is private in android lint?

I am writing a custom android lint to help to check if the private attributes match naming convention. I used the test cases to verify my implementation. I used a method called isPrivateOrParameterInPrivateMethod() to check if it is private or not…
Long Ranger
  • 5,888
  • 8
  • 43
  • 72
0
votes
1 answer

How do I run standalone lint from Android SDK Tools on a Gradle Project

When I try to run the lint tool provided in the Android SDK Command Line tools, it fails with the following error build.gradle: Error: "." is a Gradle project. To correctly analyze Gradle projects, you should run "gradlew lint" instead.…
ashu
  • 1,756
  • 4
  • 22
  • 41
0
votes
1 answer

JNI native method missing but no build error

In MyClass.java I have package com.example.foo; public class MyClass { public native void MyMethod(); and in MyClass.cpp I have JNIEXPORT void JNICALL xJava_com_example_foo_MyClass_MyMethod(JNIEnv* env, jobject thiz) { blah blah…
kbro
  • 4,754
  • 7
  • 29
  • 40
0
votes
1 answer

Can I upload lint-result.xml to SonarQube in Android Gradle project?

I got a android lint-result.xml and I`m trying to put the result of lint-result.xml to SonarQube server. I have set build.gradle like below but it doesn`t working. build.gradle sonarqube { properties { property 'sonar.projectName',…
Bh Yu
  • 17
  • 3
0
votes
1 answer

Is there a better way than self-assign value for the Livedata to update view?

For Android's LiveData, I sometimes use self-assignment so that my views can be updated. For example: fun retry() { myModel.setLoadingRetry() loadStatesMap .forEach { it.value.first?.value = t.value.first?.value …
John
  • 1,139
  • 3
  • 16
  • 33
0
votes
1 answer

Is it possible to get details with the Android Studio lint tool?

I use lint to check an Android app project: gradlew lint It shows the following: > Task :app:compileOfficialDebugJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. The…
Hong
  • 17,643
  • 21
  • 81
  • 142
0
votes
3 answers

GradleException: Lint found fatal errors while assembling a release target

After migrating my project to API 28, its compiling and working fine, even doing a Analyze/Inspect Code I'm not getting errors: But when trying to sign the project with my release keystore, I'm getting this…
NullPointerException
  • 36,107
  • 79
  • 222
  • 382