Support Gradle build cache
@greenrobot-team がすでに取り組んでいます。
2023年7月10日 から。
評価
この issue はまだ評価されていません。
説明
The bug is occurred in an Android Project.
Description of the bug
During a manual conflict resolution, the objectbox-models/default.json file may accidentally contain duplicated indexId entries. During the build time, we don't have any errors. The project builds successfully, and the build output is cached to the Gradle Build Cache. Only at runtime, when we build BoxStore instance, an error occurred: io.objectbox.exception.DbSchemaException: Duplicate index ID 2 found for property .... Moreover, when a developer fixes duplicated indexId entries in the objectbox-models/default.json file and rebuilds the project, the error is still in place due to the result of the previous build is used from the Gradle Build Cache. It incurs hard-to-debug problems for our dev team.
Basic info:
- ObjectBox version: 3.5.1
- Reproducibility: always
- Device: any device
- OS: reproduced on Android 11, 13
Steps to reproduce the behavior:
- Activate the Gradle Build Cache: add
org.gradle.caching=truein thegradle.propertiesfile. - Add two ObjectBox entities (e.g.
UserandCompany) with the uniquenameproperty. - Build the project to generate a
objectbox-models/default.jsonfile. - Make changes to the
objectbox-models/default.jsonfile: set the same value to bothindexIdentries (Company.nameandUser.name). - Rebuild the project.
- Install APK and launch the app. There is the error:
io.objectbox.exception.DbSchemaException: Duplicate index ID 2 found for property ... - Fix duplicated
indexIdin theobjectbox-models/default.jsonfile. - Rebuild the project.
- Install APK and launch the app. There is still the same error. The result of the previous build is used.
Expected behavior
- The
Duplicate index IDerror should occur during the build time, not at runtime. - Any change to the
objectbox-models/default.jsonfile should lead to the invalidation of the Gradle Build Cache to prevent the usage of stale data from the previous build.
Code
I've prepared the demo project to reproduce the problem with the described above steps:
https://github.com/rAseri/ObjectBoxDemo
Logs, stack traces
Process: com.example.myapplication, PID: 24377
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: io.objectbox.exception.DbSchemaException: Duplicate index ID 2 found for property User.name
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
- 主要言語
- Java
- スター
- 4.6k
- フォーク
- 311
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
objectbox/objectbox-java のほかの issue
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
objectbox/objectbox-java#1226 · コメント 2 件 ·
-
documentation enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
objectbox/objectbox-java#1225 · コメント 9 件 · リアクション 1 件 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
objectbox/objectbox-java#1223 · コメント 1 件 · リアクション 4 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
objectbox/objectbox-java#1211 · コメント 1 件 · リアクション 3 件 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
objectbox/objectbox-java#1198 · コメント 1 件 ·
objectbox/objectbox-java の issue をすべて見る
似ている issue
-
Bug Java Platform: Java
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-java#6138 · コメント 1 件 ·
-
bug needs triage p2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · コメント 1 件 ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/rocketmq-dashboard#4654 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100