flutter 不支持的操作:加载ObjectBox核心动态库

xuo3flqw  于 2023-03-13  发布在  Flutter
关注(0)|答案(1)|浏览(178)

我将Flutter从3.5更新为最新Flutter3.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

我也使用对象框,这是我的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

有了这个,我得到错误Loaded ObjectBox core dynamic library has unsupported version当我做flutter run,并在真实的的手机上运行应用程序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):

我还处决了

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

但没有帮助..
有人能给我指个路吗?
update:这只在调试模式下运行时发生,在发布模式flutter build apk --release上构建应用程序时,应用程序运行完美

7vhp5slm

7vhp5slm1#

这似乎是我的建设问题。gradle

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

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

相关问题