Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Change inspection profile for one specific module in project

I have several modules in Android Studio project, and I would like to change inspections settings for one of these modules. More precise, I want to turn off all Android-related inspections in one module, but leave all general Java inspections in place.

I need this because I have a not Android-specific Java library module, and that module uses java.util.Properties, and it's load method was implemented in Android API level 9. Since that library is not Andoid stuff, I have not specified Android API level at all, and Studio warns me about that.

It offers adding Android annotation to ignore that inspection, but adding Android dependency to turn off Android warning seems bad.

I can edit the settings to shitch that warning off, but I don't want to turn API level warnings in the whole project. As I found, in settings you can specify inspection setting either globally or for whole project, not for specific module.

Is there a way to change inspections settings for one module, or do some hack around?

I am using Android Studio 1.3.2.

like image 248
Lapshin Dmitry Avatar asked Nov 24 '15 10:11

Lapshin Dmitry


1 Answers

The Studio should automatically understand that the Java module has nothing with Android, and stopped Android inspections (but they were not disabled, though): I went fix something in the code, rebuilt it several times, and when I returned to warning line, it was clean.

So, I don't actually know what's going on, but I got some recomendations, that should help:

  1. Sync your Gradle project, it will try to rebuild the project. Some dependencies and settings will only resolve after Gradle will do something internal.
  2. If Gradle will fail, there might be errors in code that ruins interspections. Try to solve them.
  3. If your project history is stored in VCS, try checkout the latest clear version and sync project again.
  4. Check changes in .iml files manually. For some reason, Studio sometimes does weirds edits there, and if I rollback some of them, Studio works better.
like image 82
Lapshin Dmitry Avatar answered Nov 06 '22 20:11

Lapshin Dmitry