Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android instance app feature module fails to find a layout resource in the same module

Tags:

I have the following project structure which I want to convert to a instant apps. The installed project works fine, but when I want to runt the instant app version, the base feature module loads perfectly, but when it comes to the feature module, then it fails to find the resources from its module. When I move the resources from feature module to base module, then it recognizes them with the full package name of the base feature module.

The project structure is the following: - app module - instant app module
- base feature module - com.app.base.feature - feature module - com.app.feature.

in feature module when the resource is located in feature module itself the resources are not found, but they are found when I move the resource into the base feature module and reference them as following com.app.base.feature.R.layout.sample_layout.

EDIT: No known package when getting value for resource number 0x80060009.

Any kind of help would be appreciated :)

like image 713
X-HuMan Avatar asked Jul 05 '17 14:07

X-HuMan


1 Answers

When you modularise your app, the base feature module cannot access any classes or resources present in the feature module. However the vice versa is possible.

It might so happen that when you create the fragment, the R class might be pointing to the base module. Try specifying the full path to the feature module R class while accessing the layout and check if it solves your issue. Just go through all your R class references and specify full paths to base and feature R classes wherever necessary.

like image 171
Vishy Avatar answered Sep 23 '22 06:09

Vishy