Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Dynamic Feature Module can not access Resource file

I am trying to implement Dynamic delivery type App. First I create new project after that create Module for dynamic steps for this

Select File > New > New Module from the menu bar and Create New Module dialog, select Dynamic Feature Module and click Next.
structure of folder

I crate class and want to access resource folder for use of layout , drawable folder.

Also implemented in main module gradle

implementation 'com.google.android.play:core:1.2.0' and dynamicFeatures = [":dynamic_feature"]

but getting error for dynamic module Error display

error: cannot find symbol variable activity_main
error: cannot find symbol variable iv_forward
error: cannot find symbol variable seekBar

https://developer.android.com/studio/projects/dynamic-delivery https://proandroiddev.com/dynamic-feature-module-android-ondemand-module-android-app-bundle-ea0d872b32d

like image 496
Er.nishka Avatar asked Oct 16 '18 06:10

Er.nishka


2 Answers

For those who are faced with the same problem: You can only get resources from base module. Use:

com.example.base_module.R.drawable.item

instead off default R.drawable.item

like image 195
ivanovd422 Avatar answered Sep 24 '22 12:09

ivanovd422


If you are inside dynamic feature module and trying to access the drawable of another module. You should add the the package name of that module (in which drawable is located) as prefix like below

                btnOk.setImageResource(com.example.mysampleproject.R.drawable.Ok)
like image 21
REMIL K R Avatar answered Sep 21 '22 12:09

REMIL K R