10

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.

2 Answers 2

2

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.
0
+100

Actually you can disable particular inspections being made by Android Studio. However this needs to be on all projects you have in Android Studio, and cannot be done in all modules you are currently developing.

To disable android inspections on your projects follow these steps:

  1. Click on the File menu and Select Settings
  2. Expand the Editor root node select Inspections

There you will have all the inspections which Android Studio checks when building a project (image below). You can expand the Android node and check what you wish to remove from your inspections.

Inspection Window in Android Studio

Hope this helps :)

5
  • 2
    I knew that way. The question is how to turn if off for module. Nov 27, 2015 at 17:50
  • I don't know if there is a way how to turn it off per module Nov 27, 2015 at 20:01
  • Well obviously there is not.
    – Meo
    Nov 27, 2015 at 20:38
  • @LapshinDmitry can I be of any help to you in any other way? Dec 1, 2015 at 8:52
  • @codedByMi looks like Studio figured that it's wrong about this inspection: there is no warning right now. Will look further. Dec 1, 2015 at 10:14

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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