You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using androidx ViewModel, after set minifyEnabled true, my app crashes with message: No compatible definition found for type 'com.app.b.a.a'. Check your module definition
To Reproduce
Steps to reproduce the behavior:
Create a app with androidx ViewModel dependency
Declare a viewmodel dependency
Request the viewmodel dependency using by viewmodel
Set minifyEnable to true
Build a release
See error
Expected behavior
Find the dependency and don't crash
Koin project used and used version (please complete the following information):
[e.g]: koin-core version 1.0.0-beta3
Additional context
When activating logs, it shows: declare Factory [class='com.app.b.a.a', binds~(androidx.lifecycle.u)]
Solution
After declare proguard rule: -keepnames class androidx.lifecycle.ViewModel
logs show: declare Factory [class='com.app.b.a.a', binds~(androidx.lifecycle.ViewModel)]
and dependency resolution go fine
The text was updated successfully, but these errors were encountered:
edipo2s
changed the title
Proguard when using androidx ViewModel
Need proguard rule when using androidx ViewModel
Jul 26, 2018
this is a regression. Koin viewmodel features do not have to break pro guard.
It's fixed in 1.0.0-beta-5, you won't required any proguard rule for Koin.
Getting a crash when injecting a ViewModel -> can't replicate as it happens only in edge cases, but I do get reports back with that stacktrace from my users.
Caused by org.koin.core.error.NoBeanDefFoundException No definition found for 'c.a.a.a.e.f' has been found. Check your module definitions.
My proguard setup:
-keepnames class androidx.lifecycle.ViewModel -keepclassmembers class * extends androidx.lifecycle.ViewModel { <init>(...); } -keepclassmembers class * implements androidx.lifecycle.LifecycleObserver { <init>(...); } -keepclassmembers class * implements androidx.lifecycle.LifecycleOwner { <init>(...); } -keepclassmembers class androidx.lifecycle.Lifecycle$State { *; } -keepclassmembers class androidx.lifecycle.Lifecycle$Event { *; } -keep class * implements androidx.lifecycle.LifecycleOwner { public <init>(...); } -keep class * implements androidx.lifecycle.LifecycleObserver { public <init>(...); }
even adding -keep class androidx.lifecycle.** { *; } does not help -> still getting this issue.
Just updated to 2.0.1 with hopes that it will help.
Describe the bug
When using androidx ViewModel, after set minifyEnabled true, my app crashes with message:
No compatible definition found for type 'com.app.b.a.a'. Check your module definition
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Find the dependency and don't crash
Koin project used and used version (please complete the following information):
[e.g]:
koin-core version 1.0.0-beta3
Additional context
When activating logs, it shows:
declare Factory [class='com.app.b.a.a', binds~(androidx.lifecycle.u)]
Solution
After declare proguard rule:
-keepnames class androidx.lifecycle.ViewModel
logs show:
declare Factory [class='com.app.b.a.a', binds~(androidx.lifecycle.ViewModel)]
and dependency resolution go fine
The text was updated successfully, but these errors were encountered: