Objectbox-java: VerifyError on Android 4.2

Created on 12 Feb 2019  路  5Comments  路  Source: objectbox/objectbox-java

Issue Basics

  • ObjectBox version: 2.3.2
  • Reproducibility: always
  • Android toolchain: com.android.tools.build:gradle:3.3.1, android.enableR8=true, Gradle 5.2

Reproducing the bug

Description

When 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

Code

return MyObjectBox.builder()
    .androidContext(context)
    .build()

Logs & stackstraces

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)

Misc

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.

bug

Most helpful comment

Works, thanks a lot.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings