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
java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.
To replicate
Run the end Migration project
Click on Add Plant
Click on any plant
click on the + button
@Override
public long insertGardenPlanting(final GardenPlanting gardenPlanting) {
__db.assertNotSuspendingTransaction();
__db.beginTransaction();
try {
final long _result = __insertionAdapterOfGardenPlanting.insertAndReturnId(gardenPlanting);
__db.setTransactionSuccessful();
return _result;
} finally {
__db.endTransaction();
}
}
FATAL EXCEPTION: main
Process: com.google.samples.apps.sunflower, PID: 7036
java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.
at androidx.room.RoomDatabase.assertNotMainThread(RoomDatabase.kt:439)
at androidx.room.RoomDatabase.beginTransaction(RoomDatabase.kt:508)
at com.google.samples.apps.sunflower.data.GardenPlantingDao_Impl.insertGardenPlanting(GardenPlantingDao_Impl.java:87)
at com.google.samples.apps.sunflower.data.GardenPlantingRepository.createGardenPlanting(GardenPlantingRepository.kt:25)
at com.google.samples.apps.sunflower.viewmodels.PlantDetailViewModel$addPlantToGarden$1.invokeSuspend(PlantDetailViewModel.kt:40)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:363)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:21)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:88)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:52)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:43)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
at com.google.samples.apps.sunflower.viewmodels.PlantDetailViewModel.addPlantToGarden(PlantDetailViewModel.kt:39)
at com.google.samples.apps.sunflower.plantdetail.PlantDetailFragment$onCreateView$binding$1$1.add(PlantDetailFragment.kt:70)
at com.google.samples.apps.sunflower.databinding.FragmentPlantDetailBindingImpl._internalCallbackOnClick(FragmentPlantDetailBindingImpl.java:247)
at com.google.samples.apps.sunflower.generated.callback.OnClickListener.onClick(OnClickListener.java:11)
at android.view.View.performClick(View.java:7506)
at android.view.View.performClickInternal(View.java:7483)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:29334)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
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:936)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@bf3ec60, Dispatchers.Main.immediate]
The text was updated successfully, but these errors were encountered:
To replicate
+
buttonThe text was updated successfully, but these errors were encountered: