0

I get this error. And I have no code about inserting. What's the problem...?

2021-07-06 11:00:00.379 1189-8086/com.google.android.gms E/SQLiteDatabase: Error inserting flex_time=3097000 job_id=-1 period=6195000 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=201817000 persistence_level=1 preferred_charging_state=1 required_network_type=0 runtime=1625536800377 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:938)
        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:1701)
        at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1570)
        at apla.a(:com.google.android.gms@201817022@20.18.17 (040700-311416286):78)
        at apkp.a(:com.google.android.gms@201817022@20.18.17 (040700-311416286):196)
        at apkp.a(:com.google.android.gms@201817022@20.18.17 (040700-311416286):20)
        at apkp.a(:com.google.android.gms@201817022@20.18.17 (040700-311416286):190)
        at apgy.run(:com.google.android.gms@201817022@20.18.17 (040700-311416286):8)
        at sji.b(:com.google.android.gms@201817022@20.18.17 (040700-311416286):12)
        at sji.run(:com.google.android.gms@201817022@20.18.17 (040700-311416286):7)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at spj.run(:com.google.android.gms@201817022@20.18.17 (040700-311416286):0)
        at java.lang.Thread.run(Thread.java:923)
c-an
  • 3,543
  • 5
  • 35
  • 82
  • I think you should find the answer on https://stackoverflow.com/questions/61910260/sqliteconstraintexception-error-showing-after-start-of-every-activity. The stacktrace seems pretty much the same there. – Petr Bodnár Apr 23 '23 at 09:45

1 Answers1

0

It looks like it's violating a unique key constraint. Not sure in which column until we see the schema, but most probably its pending_ops.user_id .

Either you'll have to remove the unique key constraint to allow multiple records for the same pending_ops.user_id or you can try using this command :

INSERT or REPLACE into tablename VALUES (value1,value2 , so on );

You can try looking more on this link: SQLite3 UNIQUE constraint failed error

Shin McCold
  • 9
  • 1
  • 1