I am working on Dynamic Module Feature Delivery and i have some drawable resources inside the dynamic module as well. The problem i am facing is that i cannot get identifiers for the resources however if i directly reference any of them then it works well. So the problem occurs only while trying to access the resource identifiers. Currently i am trying to do it like this :
val resID = resources.getIdentifier("drawable_name", "drawable",packageName)
and this
val resID = resources.getIdentifier("drawable_name", "drawable","explicit package name of module")
However when i access a drawable directly like R.drawable.mydrawable
, then it works.
Please guide me as to how can i access the resource identifiers because currently its returning 0 every time which means it is unable to access the identifier.
Try adding
.modulePluginName
as suffix to your packageName.Eg. Your packageName is
com.android.test
, and your dynamic module name ismoduleHello
. Then setpluginPackageName = "com.android.test.moduleHello"
.Like this to access resources: