在源代码中未出现的列中插入行时数据库运行时异常

Database Runtime Exception while inserting a row in a column that doesn't appear in source code

虽然 运行 我的应用 logcat 显示异常:

09-28 16:37:33.364     853-2228/? E/SQLiteDatabase? Error inserting
    android.database.sqlite.SQLiteConstraintException: column context_id is not unique (code 19)
    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:1471)
    at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1339)
    at com.google.android.contextmanager.q.al.a(SourceFile:408)
    at com.google.android.contextmanager.q.al.b(SourceFile:383)
    at com.google.android.contextmanager.q.al.a(SourceFile:349)
    at com.google.android.contextmanager.q.al.b(SourceFile:376)
    at com.google.android.contextmanager.g.a.j.a(SourceFile:58)
    at com.google.android.contextmanager.g.a.a.run(SourceFile:52)
    at com.google.android.contextmanager.g.i.handleMessage(SourceFile:215)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:149)
    at android.os.HandlerThread.run(HandlerThread.java:61)

我的问题是,当我在整个项目中进行全面搜索时,context_id 列没有出现。异常信息指向 android 库中的 类,而不是我的代码。

任何线索,如何跟踪此异常?

这是在最近一次更新后开始出现在 android 设备中的东西。它很可能与您的应用无关。

除非您正在与其他 apps/services 进行通信并且需要查看他们正在记录的内容,否则您应该根据 1234-4321/ABCD 中的第一个数字过滤您的日志,因为这就是过程- 生成日志消息的进程的 ID。找到一条您知道来自您的应用的消息并将其用作参考。

如果您使用的是 Android Studio,也应该可以从下拉列表中 select 您的应用程序,并且 select "Show only selected application",其中包含和我上面描述的效果一样。