Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade error: Realm SDK package version does not match the native library version #1127

Closed
mnimer opened this issue Jan 30, 2023 · 9 comments

Comments

@mnimer
Copy link

mnimer commented Jan 30, 2023

What happened?

Received this runtime error after trying to upgrade:
Realm SDK package version does not match the native library version (0.10.0+rc != 0.8.0+rc). This is likely a bug in the Realm SDK - please file an issue at https://github.com/realm/realm-dart/issues

Upgraded 0.8.0 to 0.10.0 following the steps on this page
https://www.mongodb.com/docs/realm/sdk/flutter/install/#update-package-version

I have already tried running:

  • flutter clean
  • flutter pub cache repair
  • flutter pub get

Repro steps

Start with an existing project on ^0.8.0+rc and upgrade the project to 0.10.0, following these instructions: https://www.mongodb.com/docs/realm/sdk/flutter/install/#update-package-version

run flutter clean & build

Version

^0.8.0+rc

What Atlas Services are you using?

Local Database only

What type of application is this?

Flutter Application

Client OS and version

mac 13.1

Code snippets

final config = Configuration.local(
[Apps.schema, FileCollection.schema, Folder.schema, File.schema],
schemaVersion: 1, shouldDeleteIfMigrationNeeded: true);
database = Realm(config);

Stacktrace of the exception/crash you're getting

No response

Relevant log output

Realm SDK package version does not match the native library version (0.10.0+rc != 0.8.0+rc). This is likely a bug in the Realm SDK - please file an issue at https://github.com/realm/realm-dart/issues
@nielsenko
Copy link
Contributor

nielsenko commented Jan 30, 2023

@mnimer Hi Mike

I have failed to recreate this issue. A simple flutter pub upgrade --major-versions and then running is enough for me.

Could you try to remove your platform projects, and then re-create them with:

rm -rf android/ ios/ linux/ macos/ windows/
flutter create . --platforms=android,ios,linux,macos,windows

or whatever platforms you support.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Jan 31, 2023
@mnimer
Copy link
Author

mnimer commented Jan 31, 2023

'flutter create . --platforms=...' Was the trick! upgrade alone did not fix it but when I deleted the platform folders and rebuilt the macos platform it started working. Thank you.

@mnimer mnimer closed this as completed Jan 31, 2023
@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jan 31, 2023
@mnimer
Copy link
Author

mnimer commented Feb 1, 2023

This broke again when I turned off macos sandbox mode

<key>com.apple.security.app-sandbox</key>
<false/>

Error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RealmException: Realm SDK package version does not match the native library version (0.11.0+rc != 0.8.0+rc). This is likely a bug in the Realm SDK - please file an issue at https://github.com/realm/realm-dart/issues
#0      new _RealmCore._ (package:realm/src/native/realm_core.dart:78:7)
#1      new _RealmCore (package:realm/src/native/realm_core.dart:83:37)
#2      realmCore (package:realm/src/native/realm_core.dart:52:30)
#3      realmCore (package:realm/src/native/realm_core.dart)
#4      Configuration.defaultStoragePath (package:realm/src/configuration.dart:100:14)
#5      Configuration.defaultRealmPath (package:realm/src/configuration.dart:110:47)
#6      Configuration.defaultRealmPath (package:realm/src/configuration.dart)
#7      Configuration.defaultRealmName= (package:realm/src/configuration.dart:85:91)

@mnimer mnimer reopened this Feb 1, 2023
@nielsenko
Copy link
Contributor

This is very surprising?! Does recreating the platform project still help?

BTW, you don't need to disable the security sandbox, as long as you add the entitlement to use the network, it will work:

...
<dict>
        ...
        <key>com.apple.security.network.client</key>
        <true/>
</dict>
...

@nielsenko
Copy link
Contributor

If you run:

find ~/ -name librealm_dart.dylib

How many paths do you find, and if you feel comfortable doing so, could you share them here?

@mnimer
Copy link
Author

mnimer commented Feb 2, 2023

Needed to turn off sandbox mode for another reason. Building a desktop file manager and couldn't access some images. I did try to rebuild the platform and that did not fix it this time.

Here are the paths:

/Users/mike//Development/github/fd-app/client/binary/macos/librealm_dart.dylib
/Users/mike//Development/github/fd-app/client/build/macos/Build/Products/Debug/client.app/Contents/Frameworks/realm.framework/Versions/A/Resources/librealm_dart.dylib
/Users/mike//Development/github/fd-app/client/build/macos/Build/Products/Debug/realm/realm.framework/Versions/A/Resources/librealm_dart.dylib
/Users/mike//.pub-cache/hosted/pub.dev/realm-0.8.0+rc/macos/librealm_dart.dylib
/Users/mike//.pub-cache/hosted/pub.dev/realm-0.10.0+rc/macos/librealm_dart.dylib
/Users/mike//.pub-cache/hosted/pub.dev/realm-0.11.0+rc/macos/librealm_dart.dylib

@nielsenko
Copy link
Contributor

Could you try to remove

/Users/mike//Development/github/fd-app/client/binary/macos/librealm_dart.dylib
/Users/mike//Development/github/fd-app/client/build

and report back?

@mnimer
Copy link
Author

mnimer commented Feb 7, 2023

That seems to have done the trick, it is working now.

@mnimer mnimer closed this as completed Feb 7, 2023
@sync-by-unito sync-by-unito bot removed the Needs-Attention Reporter has responded. Review comment. label Feb 7, 2023
@koraybalci
Copy link

Same happened to me while trying to move from 1.5.0 to 1.6.0. I had attempted to upgrade the package while I was testing in debug mode with android emulator. Hot restart did not help.

Here's what worked for me:

  1. Stopped the debug mode (not the emulator entirely)
  2. Ran flutter clean
  3. Ran flutter build apk (not sure if it was relevant but I did observe Downloading Realm binaries for realm@1.6.0 to C.. in that process)
  4. Launched the app in emulator again in debug mode.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants