Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off an annoying Inspection, in Android Studio

I'm working with Android Lollypop's JobScheduler. Android Studio is flagging this code:

JobScheduler js = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);

... as an error. It compiles fine. Studio, though, thinks it knows all of the legal services, and marks it.

I'm guessing that this is an "Inspection". I searched inspections for the error message, which begins "Must be one of: Context.POWER_SERVICE" and didn't find anything.

This leads me to the specific question: "how can I turn off this, particular, annoying error". Also, the more general question: "In general, if an inspection is annoying me, how do I find it, so that I can turn it off?"

like image 458
G. Blake Meike Avatar asked Oct 18 '14 18:10

G. Blake Meike


1 Answers

General way to disable inspections you don't want in IntelliJ based IDEs:

  1. Navigate to the part of the code which shows warning caused by the inspection
  2. Hit Alt + Enter
  3. From that menu you can navigate to Edit inspection profile setting
  4. There you can either change the level of inspection (error/warning/info/...) or disable it entirely

Alternatively you can find list of all inspections in Settings/Inspections.

like image 94
Bohuslav Burghardt Avatar answered Oct 18 '22 01:10

Bohuslav Burghardt