flutterobjectboxflutter-objectbox

Unsupported operation: Loaded ObjectBox core dynamic library


I updated flutter from 3.5 to latest flutter 3.7.2

flutter --version                     
Flutter 3.7.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 12cb4eb7a0 (6 days ago) • 2023-03-01 10:29:26 -0800
Engine • revision ada363ee93
Tools • Dart 2.19.3 • DevTools 2.20.1

I also use objectbox, here is my pubspec.yaml

environment:
  sdk: ">=2.17.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  objectbox: ^1.7.2
  objectbox_flutter_libs: ^1.7.2

dev_dependencies:
  build_runner: ^2.0.0
  objectbox_generator: any

With this I am getting error Loaded ObjectBox core dynamic library has unsupported version when I do flutter run and run the app on real phone Pixel 4a android 13

E/flutter (19712): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Unsupported operation: Loaded ObjectBox core dynamic library has unsupported version 0.17.0, expected ^0.18.0
E/flutter (19712): #0      loadObjectBoxLib
bindings.dart:110
E/flutter (19712): #1      C
bindings.dart:119
E/flutter (19712): #2      C (package:objectbox/src/native/bindings/bindings.dart)
bindings.dart:1
E/flutter (19712): #3      Store.isOpen
store.dart:412
E/flutter (19712): #4      ObjectBox.create
object_box.dart:104
E/flutter (19712): <asynchronous suspension>
E/flutter (19712): #5      _appFeaturesInit
main.dart:50
E/flutter (19712): <asynchronous suspension>
E/flutter (19712): #6      main
main.dart:74
E/flutter (19712): <asynchronous suspension>
E/flutter (19712):

I also executed

bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
and 
sudo codesign --remove-signature $(which dart)                                            

But no help..

Can someone team guide me to the right direction?

update: This only happens when running in debug mode, when building app on release mode flutter build apk --release app runs perfect


Solution

  • this seems like problem with my build.gradle

        implementation "io.objectbox:objectbox-android:3.2.0"
        debugImplementation("io.objectbox:objectbox-android-objectbrowser:3.2.0")
    

    to

        implementation "io.objectbox:objectbox-android:3.5.1"
        debugImplementation("io.objectbox:objectbox-android-objectbrowser:3.5.1")