It is assumed that your resources will be publicly available in any module (library, etc.), unless you start explicitly declaring any resource in the module public. At this point, you basically choose that each resource (inside the module) be private, except that you mark it as public. This preserves backward compatibility and allows you to gradually increase access to large projects with many modules.
To make all resources private, simply add <public /> to any of your existing resource files.
The answer above talks about adding a specific resource directory only for managing public / private modifiers. Although this works, I could suggest that you manage the visibility and declaration in the main resource files next to where they are declared. Here is an example strings.xml resource file that I used with the new library module. The prefix public / private in line names is for illustration only.
RES / value / strings.xml
<resources> <string name="app_name">My Library2</string> <public type="string" name="public_string_in_lib2" /> <string name="public_string_in_lib2">public string in lib2</string> <string name="private_string_in_lib2">private string in lib2</string> </resources>
Basically, these qualifications are used to create a public.txt file built into the AAR that another module depends on. Various tools, such as Android Studio, will use this information for a flag / warning, but technically, the library consumer will not be prevented from using the resource if their equipment is not really strict.
source share