-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] KOIN Injection Crash When Using Stripe Android Version 20.0.1 #4922
Comments
Hi @Dimmondback, thanks for filing the bug.
What are the arguments that the constructor takes? What SDK methods do you call during initialization? |
SplashViewModel has arguments being passed in via DI and no such constructor/method exists with 0 arguments. For Stripe's SDK methods, I haven't included any functional code yet. This is just with importing the Stripe dependency into Gradle and running the project. The only code difference is when I switch between 20.0.0 and 20.0.1 for the dependency. |
Hi @Dimmondback, |
Hi @Dimmondback, |
Hi @Dimmondback, |
Yes we are indeed running a different version of lifecycle dependencies. Our current version is |
Hello, |
|
Summary
We are using KOIN for DI and are encountering a crash with our splash screen's ViewModel on startup with version 20.0.1. When using version 20.0.0, this crash does not occur.
Code to reproduce
Stack Trace:
2022-04-27 13:04:29.067 15887-15887/com.carvana.carvanaTest E/AndroidRuntime: FATAL EXCEPTION: main Process: com.carvana.carvanaTest, PID: 15887 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.carvana.carvanaTest/com.carvana.carvana.features.splash.SplashActivity}: java.lang.RuntimeException: Cannot create an instance of class com.carvana.carvana.features.splash.SplashViewModel at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3707) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7870) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Caused by: java.lang.RuntimeException: Cannot create an instance of class com.carvana.carvana.features.splash.SplashViewModel at androidx.lifecycle.ViewModelProvider$NewInstanceFactory.create(ViewModelProvider.kt:201) at androidx.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.kt:319) at androidx.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.kt:275) at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:184) at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:153) at com.carvana.carvana.features.splash.SplashActivity$special$$inlined$getViewModel$default$1.invoke(AnyExt.kt:53) at com.carvana.carvana.features.splash.SplashActivity$special$$inlined$getViewModel$default$1.invoke(AnyExt.kt:45) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at com.carvana.carvana.features.splash.SplashActivity.getViewModel(SplashActivity.kt:27) at com.carvana.carvana.features.splash.SplashActivity.setupObserver(SplashActivity.kt:137) at com.carvana.carvana.features.splash.SplashActivity.onCreate(SplashActivity.kt:79) at android.app.Activity.performCreate(Activity.java:8054) at android.app.Activity.performCreate(Activity.java:8034) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3688) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7870) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Caused by: java.lang.InstantiationException: java.lang.Class<com.carvana.carvana.features.splash.SplashViewModel> has no zero argument constructor at java.lang.Class.newInstance(Native Method) at androidx.lifecycle.ViewModelProvider$NewInstanceFactory.create(ViewModelProvider.kt:199) at androidx.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.kt:319) at androidx.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.kt:275) at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:184) at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:153) at com.carvana.carvana.features.splash.SplashActivity$special$$inlined$getViewModel$default$1.invoke(AnyExt.kt:53) at com.carvana.carvana.features.splash.SplashActivity$special$$inlined$getViewModel$default$1.invoke(AnyExt.kt:45) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at com.carvana.carvana.features.splash.SplashActivity.getViewModel(SplashActivity.kt:27) at com.carvana.carvana.features.splash.SplashActivity.setupObserver(SplashActivity.kt:137) at com.carvana.carvana.features.splash.SplashActivity.onCreate(SplashActivity.kt:79) at android.app.Activity.performCreate(Activity.java:8054) at android.app.Activity.performCreate(Activity.java:8034) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3688) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7870) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Android version
Android 10, 12.
Impacted devices
Test device Pixel 6 Pro. Emulator Pixel 5 API 29.
Installation method
Through gradle dependency.
kotlin: 1.6.10
stripe-android: 20.0.1
Android Gradle Plugin: 7.0.4
Gradle: Gradle 7.3
SDK classes
Version 20.0.0 works while version 20.0.1 crashes.
The text was updated successfully, but these errors were encountered: