22

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@201516038@20.15.16 (120406-309763488):76)
    at aplb.a(:com.google.android.gms@201516038@20.15.16 (120406-309763488):173)
    at aplb.a(:com.google.android.gms@201516038@20.15.16 (120406-309763488):21)
    at aplb.a(:com.google.android.gms@201516038@20.15.16 (120406-309763488):167)
    at aphk.run(:com.google.android.gms@201516038@20.15.16 (120406-309763488):8)
    at sob.b(:com.google.android.gms@201516038@20.15.16 (120406-309763488):12)
    at sob.run(:com.google.android.gms@201516038@20.15.16 (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@201516038@20.15.16 (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'
11
  • Maybe you are inserting data into the database, on activity. And unique key constraint failed because you are adding same data. May 20, 2020 at 10:07
  • 2
    This seems to be coming from GMS code. What are the versions of google library dependencies in your project?
    – laalto
    May 20, 2020 at 10:15
  • @KrishnaSony The problem is I do not insert data into database anywhere in the app. I only use one prepopulated database, which I take data from, but I do not even use it in some activities where this error occur. May 20, 2020 at 10:16
  • @laalto Added google libraries I use May 20, 2020 at 10:25
  • 6
    In my case I use 'com.google.firebase:firebase-analytics:17.4.2' and it causes me the same error. If I delete this dependency from gradle - this error disappears. So the root of the problem is with Firebase I guess.
    – Ievgen
    May 28, 2020 at 18:02

2 Answers 2

7

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.

1
  • does it related to Google Service? It says SQLiteDatabase in the log.
    – c-an
    Mar 30, 2021 at 6:25
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.