realm/realm-dart

Error version 3.3.0

AhmadFikriAS opened this issue · 12 comments

What happened?

when i change version from 2.3.0 to 3.3.0 i got error

Repro steps

image

Version

3.4.0

What Atlas Services are you using?

Local Database only

What type of application is this?

Flutter Application

Client OS and version

Windows 11

Code snippets

No response

Stacktrace of the exception/crash you're getting

Exception has occurred.
RealmException (RealmException: Cannot get app directory. Error: Realm error : Realm SDK package version does not match the native library version (3.3.0 != 2.3.0). This is likely a bug in the Realm SDK - please file an issue at https://github.com/realm/realm-dart/issues)

Relevant log output

No response

➤ PM Bot commented:

Jira ticket: RDART-1078

Looks like the native library hasn't been replaced correctly - can you try to rebuild your app?

Looks like the native library hasn't been replaced correctly - can you try to rebuild your app?

Yes, I've done a rebuild of my app

Looks like the native library hasn't been replaced correctly - can you try to rebuild your app?

Yes, I've done a rebuild of my app

its still same error

Does this happen in a brand new project? Also, can you try to remove the realm packages from %LOCALAPPDATA%\Pub\Cache and redownload them?

I didn't create a new project, and I also deleted the realm from pub/cache and re-downloaded it, but the error is still the same.

Can you also try a flutter clean inside your project root directory?

Can you also try a flutter clean inside your project root directory?

I've done that, but still the same error.

image

I think it is highly likely that you have realm_dart.dll in your project directory. Can you search for realm_dart.dll in your project directory. If it is there delete it.
If there is no realm_dart.dll in your project directory, can you search for realm_dart.dll in your drive?

The error you are getting means that realm_dart.dll version 2.3.0 is loaded in your application instead of the 3.3.0 version. You should find the realm_dart.dll and remove it so 3.3.0 is loaded instead.

There is a way to check which dll and from where is loaded in your application but it is more involved, so for now could you do what I have suggested. If it does not help I will write you what you need to do to find exactly where is this dll loaded from.

If you run the app and let it fail you can open an elevated command prompt and run this power shell command. So

  1. Run command prompt as administrator
  2. type powershell
  3. type this command while your app is running and is still opened and your VS code is showing the error

Get-Process | where {$_.Modules -match 'realm_dart.dll'} | select -ExpandProperty modules | group -Property FileName | select name | where {$_ -match 'realm_dart.dll'}

this will give you the exact path from which realm_dart.dll is loaded.

I suspect it is the root dir of your project, but maybe somewhere else.

If you run the app and let it fail you can open an elevated command prompt and run this power shell command. So

  1. Run command prompt as administrator
  2. type powershell
  3. type this command while your app is running and is still opened and your VS code is showing the error

Get-Process | where {$_.Modules -match 'realm_dart.dll'} | select -ExpandProperty modules | group -Property FileName | select name | where {$_ -match 'realm_dart.dll'}

this will give you the exact path from which realm_dart.dll is loaded.

I suspect it is the root dir of your project, but maybe somewhere else.

I think this method is very helpful, I just type in powershell and restart the application, and the error is fixed.

Thanks for your help. I really appreciate it

Glad it helped. After one successful run you should not need to this every time you start the app. This is needed only one time untill you have your app running with 3.3.0.