You.Brighton
You.Brighton

Reputation: 2068

Android Module reference layout error

I'm not good at using the modules on Android

So I have a problem. When I called module activity it must refer the module layout but actually it's referring to the App layout.

I guess it might R.java problem, but I'm not sure.

Here is how it is setup in my project. Example

Upvotes: 0

Views: 81

Answers (1)

Ted Hopp
Ted Hopp

Reputation: 234795

During the build process, any resources in a library module are ignored if the same resource appears in the main module. That's why androidmodule2.MainActivity is picking up the activity_main layout from the app module: the resource of the same name in the library module is being thrown away during the build process.

Change the name of the layout resource in one of the modules so there's no name collision and all should then be well. (Well, at least this particular problem should go away.)

Upvotes: 2

Related Questions