question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android Dynamic Delivery confusion

See original GitHub issue

What is the best way to deal with Android Dynamic Delivery? The assumption here is that part of Android app (com.android.dynamic-feature module) will be downloaded latter at some point. Assuming this dynamic Android module contains Kodein module is there any way to dynamically add it to kodein dependency tree?

Current solution works fine when all modules are known at app start.

class MyCustomApplication : KodeinAware {
    override val kodein = Kodein.lazy {
        import(androidXModule(this@ShowcaseApplication))
        import(appModule)
    }
}

However with Android dynamic modules

class MyCustomApplication : KodeinAware {
    override val kodein = Kodein.lazy {
        import(androidXModule(this@ShowcaseApplication))
        import(appModule)
    }

	//...
	fun onFeatureAlbumModuleDownloaded() {
		// retrieve insatnce of kodein module from the 
        // downloaded module via reflection

		//Add it somehow to "App level kodein"?
    } 
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
igorwojdacommented, Sep 25, 2019

I made it work with dependency inversion and a bit of reflection to dynamically retrieve KodeinModuleProvider. I am happy with the solution for now, so I will close this issue.

Here is a reference to my solution: https://github.com/igorwojda/android-showcase/blob/master/app/src/main/java/com/igorwojda/showcase/app/feature/FeatureManager.kt

1reaction
SalomonBryscommented, Aug 1, 2019

Hi @igorwojda, Have you taken a look at Configurable Kodein? I believe it fits exactly your need.

This looks like a legit reason to use mutable = true.

https://kodein.org/Kodein-DI/?6.3/configurable

Read more comments on GitHub >

github_iconTop Results From Across the Web

How Android App Bundles and Dynamic Delivery will change ...
First up, we'll be blocking uploads of split APKs to the site, as they're of limited use and are likely to just fuel...
Read more >
Overview of Play Feature Delivery | Android Developers
Play Feature Delivery uses advanced capabilities of app bundles, ... The following applies the dynamic-feature plugin to your feature module.
Read more >
Android App Bundles: there was a problem while parsing the ...
The --modules option gives you the chance to install just the specified modules. However, I guess there is no way to test the...
Read more >
Android App Bundle - Dynamic Delivery - MSDN
Android App Bundle - Dynamic Delivery RRS feed ... This is a little bit confusing, because we see the warning and think thats...
Read more >
App Failures By Koin: Story 2— Unreliable Dynamic Loading
To begin with, not every Android application needs the dynamic loading ... This will be causing some confusion, as code where a sequence...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found