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.

SavedStateHandle is not resolved when using R8

See original GitHub issue

When 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

  1. Enable R8 in the project with default configuration
  2. Inject SavedStateHandle into a viewmodel
  3. 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:closed
  • Created 10 months ago
  • Reactions:10
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
arnaudgiulianicommented, Dec 13, 2022

Fixed in 3.3.1

1reaction
arnaudgiulianicommented, Dec 12, 2022

sure, a fix is coming in koin-android 3.3.1 👍

Read more comments on GitHub >

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

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