Android Resources collision without warning!

If you develop an App with multiple modules, this is one thing you need to be extra careful. There will be no warning when it happens. Watch out!

Module based development

Assuming you have app as the main module, and you have mylibrary as a dependent module.

In the app, you have

<string name="common_name">Common Name At Base</string>

In the mylibrary, you have

<string name="common_name">Common Name At Library</string>

What you see in your mylibrary

When you use the common_name in your mylibrary layout file, you will see that Common Name At Library in your layout.xml as shown below

And in the layout viewer, you’ll see as below

The actual result

However, when you compile and run, no error, and all compiled fine and App is launched…

--

--