java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:641)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Caused by: org.koin.core.error.NoBeanDefFoundException: |- No definition found for class:'com.nav.noteit.viewmodel.NoteViewModel'. Check your definitions!
at org.koin.core.scope.Scope.throwDefinitionNotFound(Scope.kt:287)
at org.koin.core.scope.Scope.resolveValue(Scope.kt:257)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:224)
at org.koin.core.scope.Scope.get(Scope.kt:205)
at com.nav.noteit.fragments.FragNotes$special$$inlined$inject$default$1.invoke(ComponentCallbackExt.kt:61)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.nav.noteit.fragments.FragNotes.getNoteViewModel(FragNotes.kt:48)
at com.nav.noteit.fragments.FragNotes.initViewModel(FragNotes.kt:74)
at com.nav.noteit.fragments.FragNotes.setUpFrag(FragNotes.kt:56)
at com.nav.noteit.fragments.FragBase.onViewCreated(FragBase.kt:50)
at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3019)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:551)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2849)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2784)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:262)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:478)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:251)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1525)
at android.app.Activity.performStart(Activity.java:8030)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3642)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2251)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8068)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Initially it was working completly fine suddenly it is showing me this error. even after I provide all the references in module. This is my app module.
Room.databaseBuilder(get(),NoteDatabase::class.java,"note_database").fallbackToDestructiveMigration().build()
}
single {
NoteRepo(get())
}
viewModel {
NoteViewModel(get())
SearchViewModel()
}
This is how I inject and use my ViewModel.
noteViewModel.allNotes.observe(viewLifecycleOwner){
it?.let {
adapterNotes.updateList(it)
}
}
I tried removing all the changes before it was working even after removing all the changes it is still showing me this error. Please help me out with this issue.