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

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

Closed
AndyDev999 opened this issue May 6, 2023 · 2 comments

Comments

@AndyDev999
Copy link

AndyDev999 commented May 6, 2023

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
Copy link
Collaborator

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
Copy link
Author

AndyDev999 commented May 20, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants