Reputation: 28268
After an update of Android Studio I get warnings on fields like:
public int ex1 = 0;
int ex2 = 0;
or methods or nested classes when they are used only in one class or in the package:
"Access can be private" or "Access can be package-only"
This is can be, and I don't want these warnings but I cannot find how I can deactivate them. Any ideas?
Upvotes: 40
Views: 20408
Reputation: 1251
In Android Studio 2.2.1 open Settings-> Editor -> Inspections. Now go to Java->Declaration redundancy->Declaration Access Can be Weaker and uncheck this option.
Upvotes: 57
Reputation: 5980
You can also put this annotation on top of your class:
@SuppressWarnings("WeakerAccess")
Upvotes: 64
Reputation: 22041
All you have to do is disable the inspection that fires this warning. Taken from "Suppression Inspections" page in IntelliJ help:
To suppress an inspection in the editor
<inspection name>
options item.Pressing the left arrow key, or ⎋ hides the suggestion list. In the inspection options list, select the desired suppress action
The inspection will be suppressed with special comments in the corresponding piece of code.
Upvotes: 4