objectbox / objectbox-dart

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

Unsupported operation ObjectBox platform-specific library not compatible #690

Open jeremy-giles opened 1 week ago

jeremy-giles commented 1 week ago

Hello, I can't understand why all morning I can build and launch our application on Android devices and how following a pull action from our git I have the error:

I/flutter ( 6701): Unsupported operation: ObjectBox platform-specific library not compatible: is 4.0.0 (4.0.0-2024-05-14 (http, admin, lmdb, VectorSearch)), expected 4.0.1 (4.0.2-2024-10-15) or newer. For Flutter, check if the ObjectBox Pod or objectbox-android-objectbrowser need to be updated. For Dart, re-run the install.sh script to download the latest version.

NB: The problem is only in debug. The application built in release works...

pubspec.yaml

dependencies:

  flutter:
    sdk: flutter
  objectbox: ^4.0.0
  objectbox_flutter_libs: any

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^3.0.0
  objectbox_generator: any

build.gradle

// Tell Gradle to exclude the objectbox-android dependency
// that is added by objectbox_flutter_libs for debug builds.
configurations {
    debugImplementation {
        exclude group: 'io.objectbox', module: 'objectbox-android'
    }
}

dependencies {
    // Add objectbox-android-objectbrowser only for debug builds.
    // Replace <version> with the included objectbox-android version,
    // e.g. check https://github.com/objectbox/objectbox-dart/releases
    // Warning: when ObjectBox for Dart updates check if <version>
    // needs to be updated.
    debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.0.0")
}
greenrobot-team commented 1 week ago

For Flutter, check if the ObjectBox Pod or objectbox-android-objectbrowser need to be updated.

In the build.gradle posted, update objectbox-android-objectbrowser to a supported release as noted in the comment.

Note: I labeled this issue with "more info required" so it will auto-close in a few days if there are no follow-up comments.

sadespresso commented 1 week ago

Hello there! I'm having the same issue even tho I have set following:

# pubspec.yaml

dependencies:
  objectbox: ^4.0.1
  objectbox_flutter_libs: ^4.0.1
// app/build.gradle

configurations {
    debugImplementation {
        exclude group: 'io.objectbox', module: 'objectbox-android'
    }
}

dependencies {
    debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.0.1")
}
sadespresso commented 1 week ago

I'm trying to compile flutter android app on a Mac (macos 15). Additionally, I can't install libobjectbox dynamic library due to:

OK. Do you want to install the library into /usr/local/lib? [Y/n] 
Installing /usr/local/lib/libobjectbox.dylib
Password:
ls: /usr/local/lib/*: Not a directory
Error installing the library - not found

Should I need to create a separate issue for this, or is this a related issue? I'm little puzzled because I can build and debug my flutter app for iOS just fine.

jeremy-giles commented 6 days ago

Thx for your response. I build too on Mac (M2 Max - Sonoma 14.5). I don't see what additional information I can give. My colleagues, on the same project BUT on Windows environments, do not have this problem, even in debug.

Other info, similar error during iOS build:

Error: The pod "ObjectBox" required by the plugin "objectbox_flutter_libs" requires a higher minimum iOS deployment version than the plugin's reported minimum version. To build, remove the plugin "objectbox_flutter_libs", or contact the plugin's developers for assistance.

greenrobot-team commented 6 days ago

It's maybe a little bit hidden in the release notes, but the version should be 4.0.3:

If you are using Admin, make sure to update to io.objectbox:objectbox-android-objectbrowser:4.0.3 in android/app/build.gradle.

As for the macOS issue: installing the library is only necessary for Dart Native projects or for Flutter projects where unit tests run on your machine (see notes in Getting Started docs). The Flutter apps themselves bundle the ObjectBox native library via the objectbox_flutter_libs package. Regardless, the script does not appear to account for a not existing path in newer macOS versions.

@jeremy-giles If this is a different issue, please submit a new issue with details!

Note: I labeled this issue with "more info required" so it will auto-close in a few days if there are no follow-up comments.