Skip to content
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

RuntimeException: Cannot create an instance of class com.chuckerteam.chucker.internal.ui.transaction.TransactionViewModel #366

Closed
koral-- opened this issue Jun 19, 2020 · 0 comments · Fixed by #368
Labels
bug Something isn't working
Milestone

Comments

@koral--
Copy link
Contributor

koral-- commented Jun 19, 2020

✍️ Describe the bug

FATAL EXCEPTION: main
    Process: <striped>, PID: 14123
    java.lang.RuntimeException: Unable to start activity ComponentInfo{<stripped>/com.chuckerteam.chucker.internal.ui.transaction.TransactionActivity}: java.lang.RuntimeException: Cannot create an instance of class com.chuckerteam.chucker.internal.ui.transaction.TransactionViewModel
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3388)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3527)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        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:2123)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7710)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
     Caused by: java.lang.RuntimeException: Cannot create an instance of class com.chuckerteam.chucker.internal.ui.transaction.TransactionViewModel
        at androidx.lifecycle.ViewModelProvider$NewInstanceFactory.create(ViewModelProvider.java:221)
        at androidx.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.java:278)
        at androidx.lifecycle.SavedStateViewModelFactory.create(SavedStateViewModelFactory.java:112)
        at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:185)
        at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:150)
        at com.chuckerteam.chucker.internal.ui.transaction.TransactionPayloadFragment.onCreate(TransactionPayloadFragment.kt:56)
        at androidx.fragment.app.Fragment.performCreate(Fragment.java:2867)
        at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:444)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1287)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1444)
        at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1522)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1575)
        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3001)
        at androidx.fragment.app.FragmentManager.dispatchCreate(FragmentManager.java:2938)
        at androidx.fragment.app.FragmentController.dispatchCreate(FragmentController.java:240)
        at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:243)
        at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:118)
        at com.chuckerteam.chucker.internal.ui.BaseChuckerActivity.onCreate(BaseChuckerActivity.kt:11)
        at com.chuckerteam.chucker.internal.ui.transaction.TransactionActivity.onCreate(TransactionActivity.kt:24)
        at android.app.Activity.performCreate(Activity.java:7820)
        at android.app.Activity.performCreate(Activity.java:7809)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1318)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3363)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3527) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
        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:2123) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7710) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 
     Caused by: java.lang.InstantiationException: java.lang.Class<com.chuckerteam.chucker.internal.ui.transaction.TransactionViewModel> has no zero argument constructor
        at java.lang.Class.newInstance(Native Method)
        at androidx.lifecycle.ViewModelProvider$NewInstanceFactory.create(ViewModelProvider.java:219)
        at androidx.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.java:278) 
        at androidx.lifecycle.SavedStateViewModelFactory.create(SavedStateViewModelFactory.java:112) 
        at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:185) 
        at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:150) 
        at com.chuckerteam.chucker.internal.ui.transaction.TransactionPayloadFragment.onCreate(TransactionPayloadFragment.kt:56) 
        at androidx.fragment.app.Fragment.performCreate(Fragment.java:2867) 
        at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:444) 
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1287) 
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1444) 
        at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1522) 
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1575) 
        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3001) 
        at androidx.fragment.app.FragmentManager.dispatchCreate(FragmentManager.java:2938) 
        at androidx.fragment.app.FragmentController.dispatchCreate(FragmentController.java:240) 
        at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:243) 
        at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:118) 
        at com.chuckerteam.chucker.internal.ui.BaseChuckerActivity.onCreate(BaseChuckerActivity.kt:11) 
        at com.chuckerteam.chucker.internal.ui.transaction.TransactionActivity.onCreate(TransactionActivity.kt:24) 
        at android.app.Activity.performCreate(Activity.java:7820) 
        at android.app.Activity.performCreate(Activity.java:7809) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1318) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3363) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3527) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
        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:2123) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7710) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 

💣 Steps to reproduce

  1. Go to any request
  2. Click on share as curl, but may be anything probably

🔧 Expected behavior

There is no crash.

📱 Tech info

  • Device: OnePlus 7
  • OS: 10
  • Chucker version: 3.2.0

📄 Additional context

Enable don't keep activities to reproduce it easier

@vbuberen vbuberen added the bug Something isn't working label Jun 19, 2020
@vbuberen vbuberen added this to the 3.3.0 milestone Jun 19, 2020
@ghost ghost added the Pending PR The resolution for the issue is in PR label Jun 28, 2020
@ghost ghost removed Pending PR The resolution for the issue is in PR bug Something isn't working labels Jul 4, 2020
@cortinico cortinico added the bug Something isn't working label Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants