我正在用objectBox作为DB构建我的新的颤振应用程序。
当我编写包含objectBox的单元测试时,在运行测试时会收到以下错误消息:
加载"C:\Dev\flutter_rebuild\test\db_model_test.dart":无效参数
失败:未能加载动态库'lib/objectbox.dll':126
发布于 2021-10-19 13:25:12
我在https://opensourcelibs.com/lib/objectbox-dart上找到了这个,它展示了如何将包含"objectbox.dll“的内容下载到Windows中,这样测试就可以在Android中运行。
- Install the packages pub get
- Install objectbox-c system-wide:
- macOS/Linux: execute the following command (answer Y when it asks about installing to /usr/lib)bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
- macOS: if dart later complains that it cannot find the libobjectbox.dylib you probably have to unsign the dart binary (source: dart issue):sudo codesign --remove-signature $(which dart)
- Windows: use "Git Bash" or similar to execute the following commandbash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
然后将下载的lib/objectbox.dll复制到C:\Windows\System32 32\(需要管理权限)。
ObjectBox为您希望使用build_runner存储的类生成代码绑定代码。在定义了持久化实体(参见下面)之后,运行pub run build_runner build或flutter pub run build_runner build。
https://stackoverflow.com/questions/69631115
复制相似问题