com.android.tools.build:gradle:3.3.1, android.enableR8=true, Gradle 5.2When deploying ObjectBox 2.3.2 on Android 4.2, the app crashes with a VerifyError originating in the ObjectBox code. The code runs fine on Android 9. I'm upgrading from 2.2.0 which works with the same code on Android 4.2 and 9.
Emulator definition: avdmanager create avd -k 'system-images;android-17;google_apis;x86' -d 'Nexus 4' -n 'JellyBean_GoogleAPI_x86' -c 1G
return MyObjectBox.builder()
.androidContext(context)
.build()
02-12 07:53:50.436 2843-2843/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.VerifyError: io/objectbox/BoxStoreBuilder
at com.example.MyObjectBox.builder(MyObjectBox.java:21)
I haven't found any mentions of supported Android versions in the docs or in the change log. It would be nice if there was a clear statement somewhere.
ObjectBox should support Android 4.0 and newer.
https://docs.objectbox.io/faq#on-which-platforms-does-objectbox-run
VerifyError looks like an issue with R8. Can you try to disable it (remove android.enableR8=true) and see if the error no longer occurs?
-ut
R8 enabled/disabled makes not difference.
Thanks, confirmed. This is due to usage of ReflectiveOperationException which is only available on Android K+ (SDK 19+).
For now you should be able to use ObjectBox 2.3.1.
edit: fixed internally. Should be resolved with the next update.
-ut
The fix has just been released in Version 2.3.3. Please let us know if it's working for you (also).
Works, thanks a lot.
Most helpful comment
Works, thanks a lot.