0

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...

1 Answer 1

0

resolved:

We can use application context only after install in that "session". After restarting app and SplitCompat.install() (in application & activity) all DFM resources available by activity context only

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.