Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLiteConstraintException error showing after start of every activity

I have this error popping out in logcat all the time. It always shows after every change of activity. And sometimes, the app disappears and in a second it shows again. There is not any fatal error in logcat, all I see is this:

2020-05-20 11:53:26.422 2940-8484/? E/SQLiteDatabase: Error inserting flex_time=3324000 job_id=-1 period=6650000 source=16 requires_charging=0 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService user_id=0 target_package=com.google.android.gms tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG task_type=0 required_idleness_state=0 service_kind=0 source_version=201516000 persistence_level=1 preferred_charging_state=1 required_network_type=0 runtime=1589968406417 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}} last_runtime=0
android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE)
    at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
    at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:879)
    at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
    at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88)
    at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1599)
    at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1468)
    at aplm.a(:com.google.android.gms@[email protected] (120406-309763488):76)
    at aplb.a(:com.google.android.gms@[email protected] (120406-309763488):173)
    at aplb.a(:com.google.android.gms@[email protected] (120406-309763488):21)
    at aplb.a(:com.google.android.gms@[email protected] (120406-309763488):167)
    at aphk.run(:com.google.android.gms@[email protected] (120406-309763488):8)
    at sob.b(:com.google.android.gms@[email protected] (120406-309763488):12)
    at sob.run(:com.google.android.gms@[email protected] (120406-309763488):7)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at sub.run(:com.google.android.gms@[email protected] (120406-309763488):0)
    at java.lang.Thread.run(Thread.java:919)

But it does not show anywhere to the code is there any solution to it?

Edit: Google libraries:

implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.firebase:firebase-core:17.1.0'
implementation 'com.google.firebase:firebase-database:19.0.0'
implementation 'com.google.firebase:firebase-analytics:17.0.1'
implementation 'com.google.firebase:firebase-perf:19.0.0'
implementation 'com.google.android.gms:play-services-ads:18.1.1'
like image 859
Adam Knirsch Avatar asked May 20 '20 10:05

Adam Knirsch


2 Answers

From this issue opened in the firebase-android-sdk project:

Since it requires an update to play services, I'm holding off from giving you a timeline for when this will roll out. But, this would require no action/SDK upgrades from developers and should get fixed on your customer devices automatically.

like image 107
Gustavo Avatar answered Nov 18 '22 21:11

Gustavo


i had same issue. my case solved by adding firebase messaging artifactory to module gradle file:

implementation 'com.google.firebase:firebase-messaging:20.2.3'

your case maybe fix by adding missing library.

like image 34
reza rayatnia Avatar answered Nov 18 '22 19:11

reza rayatnia