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

Failed to load dynamic library 'librealm_dart.so' #1595

Closed
Jyoshnarani opened this issue Mar 21, 2024 · 33 comments · Fixed by #1614
Closed

Failed to load dynamic library 'librealm_dart.so' #1595

Jyoshnarani opened this issue Mar 21, 2024 · 33 comments · Fixed by #1614
Assignees
Labels
More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community SDK-Use:Local T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed

Comments

@Jyoshnarani
Copy link

Jyoshnarani commented Mar 21, 2024

h3.

What happened?

A bug happened!

Application is going to crash

Repro steps

Showing error

======== Exception caught by widgets library =======================================================
The following RealmError was thrown building Builder:
Realm error : Invalid argument(s): Failed to load dynamic library 'librealm_dart.so': dlopen failed: library "librealm_dart.so" not found
Invalid argument(s): Failed to load dynamic library '/system/bin/librealm_dart.so': dlopen failed: library "/system/bin/librealm_dart.so" not found
Invalid argument(s): Failed to load dynamic library 'librealm_dart.so': dlopen failed: library "librealm_dart.so" not found

The relevant error-causing widget was:

Version

Dart version 3.3.1

What Atlas Services are you using?

Local Database only

What type of application is this?

Flutter Application

Client OS and version

Android 13

Code snippets

No response

Stacktrace of the exception/crash you're getting

No response

Relevant log output

No response

Copy link

sync-by-unito bot commented Mar 21, 2024

➤ PM Bot commented:

Jira ticket: RDART-983

@nielsenko
Copy link
Contributor

Hi @Jyoshnarani

What version of Realm? (2.0.0?)

Device or emulator (or both)?

Did the problem occur after upgrading an existing project, or when creating a new one?

If upgrading, then from what version?

Did you try flutter clean?

If that didn't help. Did you try re-creating the android project:

rm -rf android
flutter create . --platforms=android # ,...

@Jyoshnarani
Copy link
Author

Jyoshnarani commented Mar 21, 2024

Hello @nielsenko

What version of Realm? (2.0.0?) - 2.0.0 (I faced issue in 1.9.0 also)
Device or emulator (or both)? - both
Did the problem occur after upgrading an existing project, or when creating a new one? - existing project
If upgrading, then from what version? - 1.8.0
Did you try flutter clean? - yes

@nielsenko
Copy link
Contributor

@Jyoshnarani What desktop are you on? The instructions for re-creating the android flutter project is for macos, and linux.

@Jyoshnarani
Copy link
Author

@nielsenko , It's android flutter project

@nielsenko
Copy link
Contributor

Yes, but your development machine? What OS is that?

@Jyoshnarani
Copy link
Author

Desktop - Windows

@nielsenko
Copy link
Contributor

nielsenko commented Mar 21, 2024

Could you try re-creating the android platform project, and report back?

@nielsenko
Copy link
Contributor

nielsenko commented Mar 21, 2024

I have tried upgrading and downgrading between 1.8.0, 1.9.0, and 2.0.0 and running on an android emulator.

Apart from the breaking change, regarding naming of part files (x.realm.dart instead of x.g.dart) introduced in 2.0.0, it went without any hickups.

I'll need further info to proceed with this.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Mar 21, 2024
@Jyoshnarani
Copy link
Author

@nielsenko ,

Yes you can ask which details you need from my end.

@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 Mar 21, 2024
@nielsenko
Copy link
Contributor

Hi @Jyoshnarani

Could you try re-creating the android platform project, and report back?

@Jyoshnarani
Copy link
Author

@nielsenko !

I check with new project and I went through x.realm.dart also.

But same error.

ImportedPhoto_1711015595742

@Jyoshnarani
Copy link
Author

Dart version is same

Package :
realm_dart: 2.0.0

@nielsenko
Copy link
Contributor

nielsenko commented Mar 21, 2024

Could you do flutter clean again, and then attach the output from flutter build apk?

@Jyoshnarani
Copy link
Author

√ Built build\app\outputs\flutter-apk\app-debug.apk.
Debug service listening on ws://127.0.0.1:61847/ToH4MC9eSu4=/ws
Syncing files to device ...
D/VRIMainActivity: debugCancelDraw some OnPreDrawListener onPreDraw return false,cancelDraw=true,count=50,android.view.ViewRootImpl@e79db6b
D/VRIMainActivity: debugCancelDraw cancelDraw=false,count = 812,android.view.ViewRootImpl@e79db6b
D/VRIMainActivity: registerCallbacksForSync syncBuffer=false
D/VRIMainActivity: Received frameCommittedCallback lastAttemptedDrawFrameNum=1 didProduceBuffer=true syncBuffer=false
W/Parcel (21178): Expecting binder but got null!
D/VRIMainActivity: draw finished.
D/VRIMainActivity: onFocusEvent true
D/VRIMainActivity: send msg MSG_WINDOW_FOCUS_CHANGED with caller android.view.ViewRootImplExtImpl.markAndDumpWindowFocusChangeMsg:1003 android.view.ViewRootImpl.windowFocusChanged:9827 android.view.ViewRootImpl$WindowInputEventReceiver.onFocusEvent:9540 android.os.MessageQueue.nativePollOnce:-2 android.os.MessageQueue.next:349 android.os.Looper.loopOnce:186 android.os.Looper.loop:351 android.app.ActivityThread.main:8423 java.lang.reflect.Method.invoke:-2 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run:584 com.android.internal.os.ZygoteInit.main:1013
D/VRIMainActivity: handleWindowFocusChanged mWindowFocusChanged true mUpcomingWindowFocus true mAdded true
D/OplusScrollToTopManager(21178): com.example.untitled/com.example.untitled.MainActivity,This DecorView@83ce1b0[MainActivity] change focus to true

======== Exception caught by widgets library =======================================================
The following RealmError was thrown building Builder:
Realm error : Invalid argument(s): Failed to load dynamic library 'librealm_dart.so': dlopen failed: library "librealm_dart.so" not found
Invalid argument(s): Failed to load dynamic library '/system/bin/librealm_dart.so': dlopen failed: library "/system/bin/librealm_dart.so" not found
Invalid argument(s): Failed to load dynamic library 'librealm_dart.so': dlopen failed: library "librealm_dart.so" not found

The relevant error-causing widget was:

When the exception was thrown, this was the stack:
#0 _openRealmLib (package:realm_dart/src/init.dart:84:3)
#1 initRealm (package:realm_dart/src/init.dart:108:24)
#2 _realmLib. (package:realm_dart/src/native/realm_core.dart:47:31)
#3 _realmLib (package:realm_dart/src/native/realm_core.dart:55:2)
#4 _realmLib (package:realm_dart/src/native/realm_core.dart)
#5 new _RealmCore (package:realm_dart/src/native/realm_core.dart:104:5)
#6 realmCore (package:realm_dart/src/native/realm_core.dart:81:24)
#7 realmCore (package:realm_dart/src/native/realm_core.dart)

@nielsenko
Copy link
Contributor

What files do you see below:

%LOCALAPPDATA%\Pub\Cache\hosted\pub.dev\realm-2.0.0\android\src\main\cpp\lib

@Jyoshnarani
Copy link
Author

Here it is.

image_2024_03_21T11_07_02_012Z

@nielsenko
Copy link
Contributor

Sorry, recursively?

@Jyoshnarani
Copy link
Author

Ok, But Is there any solution?

Exiting Project is in live.

I'm facing this issue since last 2 days.

@nielsenko
Copy link
Contributor

nielsenko commented Mar 21, 2024

Erhh 2.0.0 was released yesterday? You are the only one I know of with this problem?

@nielsenko
Copy link
Contributor

Apparently the app cannot load the shared library that is the core of the realm database.

Given, what you have already tried I suspect that it somehow doesn't get bundled at all. Hence why I want to see the files I requested, since that is where the file will be downloaded to.

You can also try to unzip the .apk and see if you can find it in there. It should be, actually 4 versions of it:

lib/arm64-v8a/librealm_dart.so
lib/armeabi-v7a/librealm_dart.so
lib/x86/librealm_dart.so
lib/x86_64/librealm_dart.so

@Jyoshnarani
Copy link
Author

Can you say what is the means of the error.

Invalid argument(s): Failed to load dynamic library '/system/bin/librealm_dart.so': dlopen failed: library "/system/bin/librealm_dart.so" not found

@nielsenko
Copy link
Contributor

nielsenko commented Mar 21, 2024

It fails to load the dynamic library as I said. It will look for it in multiple places.

@Jyoshnarani
Copy link
Author

One of my colleague, He tried and he faced below error.
Uploading Screenshot_1711020607.png…

@nielsenko
Copy link
Contributor

Are you by any chance running the same project?

@Jyoshnarani
Copy link
Author

No in another project (New) he is using same package.

Deferent windows.

@nielsenko
Copy link
Contributor

nielsenko commented Mar 21, 2024

If it is a brand new project, I assume he could bundle it up in a zip file and attach it here. Then I can take a look.

Including the build folder, please.

@Jyoshnarani
Copy link
Author

untitled.zip
last_build_run.json

@Jyoshnarani
Copy link
Author

With build its 600 MB - so unable to upload

@nielsenko
Copy link
Contributor

nielsenko commented Mar 21, 2024

Could you upload just the generated .apk? It should be less than 40MIB I guess.

Not sure what the last_build_run.json is. It is just 27B and contains only: ["--track-widget-creation"]

EDIT: No need for this!

@nielsenko
Copy link
Contributor

Could you please update your pubspec.yaml to take a dependency on realm? Currently you only have a dependency on realm_dart. The realm package makes sure that your app includes the native library.

@nielsenko nielsenko self-assigned this Mar 21, 2024
@Jyoshnarani
Copy link
Author

release.zip

@nielsenko
Copy link
Contributor

So adding a dep on realm fixed the project in untitled.zip that you uploaded. Can you confirm, the same for you other project?

@nielsenko nielsenko changed the title Run Time Issue Failed to load dynamic library 'librealm_dart.so' Mar 21, 2024
@sync-by-unito sync-by-unito bot added More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels Mar 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community SDK-Use:Local T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants