SavedStateHandle is not resolved when using R8
See original GitHub issueWhen using SavedStateHandle starting with 3.2.2, injecting SavedStateHandle crashes the app.
Specifically, the function named needSavedStateHandle()
which retrieves it using class name which will be erased.
To Reproduce
- Enable R8 in the project with default configuration
- Inject SavedStateHandle into a viewmodel
- App crashes with
NoBeanDefinitionException
Expected behavior SavedStateHandle is injected
Koin project used and used version (please complete the following information): 3.2.2
Temporary fix:
Add SavedStateHandle
to keep rules.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:10
- Comments:7 (3 by maintainers)
Top Results From Across the Web
savedStateHandle not saving State - android - Stack Overflow
For this reason, I decided to use saved State for viewModel . Here's my viewModel : class TimerViewModel(private val savedStateHandle: ...
Read more >Saving UI state with ViewModel SavedState and Dagger
The way it works is by passing a SavedStateHandle to the ViewModel's constructor, which you can then use to restore/save the state. We...
Read more >R8: Unexpected error during rewriting of Kotlin metadata for ...
For the project I've linked, it ended up not being necessary anymore and removing the dependency did correctly resolve the failure.
Read more >Navigation | Android Developers
Navigation Safe Args will no longer cause deprecation warnings in generated classes ... Name , fixing issues when using R8 3.1 full mode....
Read more >Kodein - Bountysource
Our Android app is using R8 in full mode for release builds, ... Kodein DI has an androidx module, but no special handling...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed in 3.3.1
sure, a fix is coming in
koin-android
3.3.1 👍