Mindinventory / Lassi-Android

All in 1 picker library for android.
https://www.mindinventory.com/android-application-development.php
MIT License
201 stars 50 forks source link

Crash : android.database.sqlite.SQLiteConstraintException - FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY) #95

Closed AndyDev999 closed 11 months ago

AndyDev999 commented 1 year ago

MediaFileDao_Impl$6.call android.database.sqlite.SQLiteConstraintException - FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)

MediaFileDao_Impl.java:144

Crash occurred: Model: Redmi Note 9 Pro(API 12) Model: Redmi Note 8 (API 11) Model: OnePlus 7(API 11)

Fatal Exception: android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)
       at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(SQLiteConnection.java)
       at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:940)
       at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
       at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:89)
       at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.java:51)
       at androidx.room.EntityInsertionAdapter.insert(EntityInsertionAdapter.java:64)
       at com.lassi.data.media.entity.MediaFileDao_Impl$6.call(MediaFileDao_Impl.java:144)
       at com.lassi.data.media.entity.MediaFileDao_Impl$6.call(MediaFileDao_Impl.java:139)
       at androidx.room.CoroutinesRoom$Companion$execute$2.invokeSuspend(CoroutinesRoom.kt:65)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at androidx.room.TransactionExecutor$1.run(TransactionExecutor.java:47)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
       at java.lang.Thread.run(Thread.java:1012)

This is the code:

 llCamera.setOnClickListener {
                        val imagePicker = Lassi(this@BusinessInfoActivity)
                            .with(LassiOption.CAMERA)
                            .setMaxCount(1)
                            .setGridSize(3)
                            .setMediaType(MediaType.IMAGE)
                            .setCompressionRation(Constants.IMAGE_PICKER_COMPRESSION_RATIO)
                            .setStatusBarColor(R.color.colorPrimaryDark)
                            .setToolbarResourceColor(R.color.colorPrimaryDark)
                            .setToolbarResourceColor(R.color.white)
                            .setProgressBarColor(R.color.loader_tint_color)
                            .setCropType(CropImageView.CropShape.RECTANGLE)
                            .enableFlip()
                            .enableRotate()
                            .enableActualCircleCrop()
                            .setCropAspectRatio(1, 1)
                        val intent: Intent = imagePicker.build()
                        pickImageReceiveData.launch(intent)
sanjay-mi commented 1 year ago

Hello @AndyDev999

Thank you for using Lassi Library.

Can you please give us the Lassi library version which you have used? We have tried to regenerate the issue with version 1.2.0 but not able to reproduce it. You can try the latest Lassi version and check it. Also, you can check with the lassi sample.

Thank you

AndyDev999 commented 1 year ago

I have found this crash with 1.1.0 version. The main problem here is lib (1.1.0) run smoothly on almost devices but it throw error for a few users (~0.1%) I found total 12 crash events in firebase crashlytics. Device : 66% - Xiaomi 17% - Oppo 17% - Oneplus

Operating system : 83% - Android 11 17% - Android 12

Device Status : 0% - In background 0% - Rooted 92% - Proximity on