objectbox / objectbox-dart

Flutter database for super-fast Dart object persistence
https://docs.objectbox.io/getting-started
Apache License 2.0
927 stars 115 forks source link

Unhandled Exception: Unsupported operation: Loaded ObjectBox core dynamic library has unsupported version 0.17.0, expected ^0.18.0 #499

Closed pMertDogan closed 1 year ago

pMertDogan commented 1 year ago

Upgraded pub.yaml dependencies and runned build runner all is okey but when I was start app its throw an error

Basic info (please complete the following information):

Additionally, you can choose to provide more details, e.g. the output of:

Logs, stack traces

If applicable, add relevant logs, or a stack trace.

E/flutter ( 6066): [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 ( 6066): #0      loadObjectBoxLib
package:objectbox/…/bindings/bindings.dart:110
E/flutter ( 6066): #1      C
package:objectbox/…/bindings/bindings.dart:119
E/flutter ( 6066): #2      C (package:objectbox/src/native/bindings/bindings.dart)
package:objectbox/…/bindings/bindings.dart:1
E/flutter ( 6066): #3      new Model
package:objectbox/…/native/model.dart:19
E/flutter ( 6066): #4      new Store
package:objectbox/…/native/store.dart:175
E/flutter ( 6066): #5      openStore
package:p763_quiz/objectbox.g.dart:161
E/flutter ( 6066): <asynchronous suspension>
E/flutter ( 6066): #6      StorageServiceObjectBox.getInstance
package:p763_quiz/…/storage/storageServiceObjectbox.dart:26
E/flutter ( 6066): <asynchronous suspension>
E/flutter ( 6066): #7      main
package:p763_quiz/main.dart:79
E/flutter ( 6066): <asynchronous suspension>
E/flutter ( 6066):
greenrobot commented 1 year ago

Do you know if this is restricted to upgrading from a previous version? E.g. does it work using a new project?

pMertDogan commented 1 year ago

Hi Greenrobot ,

Did not tested it on new project

pMertDogan commented 1 year ago

Is it related with this commit?

https://github.com/objectbox/objectbox-dart/commit/d9da16d6158e2df89858198327a4747930bd525c

zuboje commented 1 year ago

I am getting the very same error, but a different number:

Loaded ObjectBox core dynamic library has unsupported version 0.15.2, expected ^0.18.0

To test, I created a new project from scratch and everything works as expected. Upgrading the existing project from 1.6.2 -> 1.7.0 generated the error above for me. My flutter info:

flutter doctor -v
[✓] Flutter (Channel stable, 3.3.10, on Microsoft Windows [Version 10.0.22621.963], locale en-US)
    • Flutter version 3.3.10 on channel stable at C:\Users\Developer\source\repos\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (4 weeks ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\Developer\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.4.33205.214
    • Windows 10 SDK version 10.0.22000.0

[✓] Android Studio (version 2021.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.74.2)
    • VS Code at C:\Users\Developer\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.56.0

[✓] Connected device (4 available)
    • G80 (mobile)      • 1080308020406374 • android-arm64  • Android 9 (API 28)
    • Windows (desktop) • windows          • windows-x64    • Microsoft Windows [Version 10.0.22621.963]
    • Chrome (web)      • chrome           • web-javascript • Google Chrome 108.0.5359.125
    • Edge (web)        • edge             • web-javascript • Microsoft Edge 108.0.1462.76

[✓] HTTP Host Availability
    • All required HTTP hosts are available
greenrobot-team commented 1 year ago

@pMertDogan @zuboje Can you try running flutter clean to clean your build folder? This will make sure the core dynamic library (DLL) is re-downloaded.

Edit: I tested with our relations example app without issues (flutter clean, set objectbox version to 1.6.2 and run flutter pub get, run the app, set objectbox version to ^1.6.2 and run flutter pub upgrade, run the app; also checked that the DLL in the build/windows/_deps/objectbox-download-src folder updates).

zuboje commented 1 year ago

@pMertDogan @zuboje Can you try running flutter clean to clean your build folder? This will make sure the core dynamic library (DLL) is re-downloaded.

Edit: I tested with our relations example app without issues (flutter clean, set objectbox version to 1.6.2 and run flutter pub get, run the app, set objectbox version to ^1.6.2 and run flutter pub upgrade, run the app; also checked that the DLL in the build/windows/_deps/objectbox-download-src folder updates).

This didn't solve it for me, still have the same error, I also don't see the following folder:

build/windows/*

In addition to this, I did try re-downloading the required files using bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh), but still same error shows up.

greenrobot-team commented 1 year ago

@zuboje OK, what device (and operating system) are you actually trying to run this on? If Android, do you have ObjectBox Admin added? Then you need to make sure to update its version.

zuboje commented 1 year ago

@greenrobot-team I was running my tests on Android in debug mode. And yes indeed, in my build.gradle I changed:

from io.objectbox:objectbox-android-objectbrowser:3.1.2 to io.objectbox:objectbox-android-objectbrowser:3.5.0

And this solved the problem for me

mahdieyv99 commented 1 year ago

@zuboje Thank you

pMertDogan commented 1 year ago

@zuboje Thanks, it looks like we forget to update objectbox admin. Let us mention this in the documents. @greenrobot

Solution update android\build.gradle file with the latest version of the object box android

https://github.com/objectbox/objectbox-java/releases/tag/V3.5.0

Forms9 commented 1 year ago

Hi, I am using this in flutter and getting the same error when using to build my code for flutter desktop any solutions?

greenrobot-team commented 1 year ago

@Forms9 Assuming you have set up ObjectBox Admin in your app, make sure to update to the objectbox-android version shipped with the Dart package: https://docs.objectbox.io/data-browser#setup

E.g. objectbox 2.0.0 ships with objectbox-android 3.5.1.