E/SQLiteDatabase: Error inserting after build

Hello!

We are making our application with Expo. Everything went fine, on expo environment and after build on iOS. But on Android build (both apk and app bundle) on some devices (Xiaomi MIUI especially) app crashes after clicking one type of navigation links (so it might be an error on particular view or navigation link construction).

App is crashing without any error (even Sentry doesn’t catch any), so I’ve managed to run an app with Android studio and found some error message in Logcat:

2020-05-11 19:55:03.292 8141-1611/? E/SQLiteDatabase: Error inserting service_kind=0 source=16 tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG target_package=com.google.android.gms requires_charging=0 source_version=201516000 required_network_type=0 flex_time=2854000 persistence_level=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService runtime=1589219703289 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}} preferred_network_type=1 required_idleness_state=0 preferred_charging_state=1 period=5709000 last_runtime=0 task_type=0 job_id=-1 user_id=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)
        at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
        at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:782)
        at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
        at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
        at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1474)
        at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1343)
        at apnp.a(:com.google.android.gms@201516020@20.15.16 (040406-309763488):76)
        at apne.a(:com.google.android.gms@201516020@20.15.16 (040406-309763488):173)
        at apne.a(:com.google.android.gms@201516020@20.15.16 (040406-309763488):21)
        at apne.a(:com.google.android.gms@201516020@20.15.16 (040406-309763488):167)
        at apjn.run(:com.google.android.gms@201516020@20.15.16 (040406-309763488):8)
        at ssd.b(:com.google.android.gms@201516020@20.15.16 (040406-309763488):12)
        at ssd.run(:com.google.android.gms@201516020@20.15.16 (040406-309763488):7)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at sye.run(:com.google.android.gms@201516020@20.15.16 (040406-309763488):0)
        at java.lang.Thread.run(Thread.java:760)

Expo diagnostics:

Expo CLI 3.20.3 environment info:
    System:
      OS: macOS 10.15.4
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 13.8.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.13.6 - /usr/local/bin/npm
    IDEs:
      Android Studio: 3.6 AI-192.7142.36.36.6392135
      Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
    npmPackages:
      expo: ~36.0.0 => 36.0.2 
      react: ~16.9.0 => 16.9.0 
      react-dom: ~16.9.0 => 16.9.0 
      react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4 
      react-native-web: ~0.11.7 => 0.11.7 
    npmGlobalPackages:
      expo-cli: 3.20.3

I was experiencing the same thing on android and showed the same similar error.

In my app the button i was pressing was opening a NavigationStack screen that contains MapView.
I was debugging the apk in android studio and the app would restarts after it crashes…

When the app restarts in log cat it logs the params about the apk i am debuging… including why it failed last time. If you dont have MapView its probably something you are using that requires API key in the manifest file in expo…app.json.

1 Like

That was it! I forgot about an api key (since it was working on expo build and iOS). Thank you!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.