In our app we start using Dynamic Feature Module (DFM) for big resources. We move most of drawables to DFM and load them if needed.
For loading drawable using a Provider and application context (as in documentation), and it works only if dfm loaded
val drawable = ContextCompat.getDrawable(applicationContext, DFM.getDrawableResID(m_drawableName));
DFM.getDrawableResID(m_drawableName) - return resource ID (DrawableRes) from module
in Application class overrided attachBaseContext
override fun attachBaseContext(base: Context ) {
super.attachBaseContext(base)
SplitCompat.install(this)
}
in MainActivity of main module attachBaseContext overrided too
override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(newBase)
SplitCompat.installActivity(this)
}
Downloading module works and after downloading there is a drawables in a list. But after app restart always -
No package ID 7e found for ID 0x7e010219
Fatal Exception: android.content.res.Resources$NotFoundException
Resource ID #0x7e0101e4
Module installed and file list get from module without problems...