18

I have created custom android Lint check rule it works well when I run it from command line but Android Studio does not take that rule when checking it with "Inspect Code".I have selected all the Lint Rules in Inspection Profile of android studio.

What I did is

  1. Created JAR with custom lint check rule
  2. Placed the jar into ~/.android/lint

When I run the lint checking from command line it works as it should. like below output shows it check against the rule.

lint OpenGLLearning
Scanning OpenGLLearning: ...............................
Scanning OpenGLLearning (Phase 2): ....

res/layout/activity_opengl.xml:8: Error: Edit Text ID Must be starting with et [etName]
<EditText
^

Here etName is my Issue ID for custom lint rule which I created. but Android Studio does not list "etName" rule anywhere and not show error when checked against lint with Inspect Code.

when I run

./gradlew check

it does checks against rule.and custom rule also appears when I run lint --list command on terminal but not able to figure out why it not checked by Inspect Code in Android Studio.

I am using build tools 21.0.2 and Target Version 21

2
  • I've run into the same issue for Intellij IDEA. Hmm, no wonder, as it's based on the same code as Android Studio. Dec 7, 2014 at 22:14
  • Were you able to solve this issue?
    – Stefan Arn
    Apr 3, 2017 at 12:06

1 Answer 1

2

i solved this by adding jar module into project and explicitly specifying lint dependency in app.gradle

lintChecks project(':your_module_name')  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.