Repository navigation
Rust with Native Android / iOS #208
Description
Activity
I wrote a walkthrough, Build and Run Node-API Modules in React Native, which shows how to create a Node-API module to run on Node.js, Android, and iOS.
I am not familiar with the Ferric side of things, but hopefully that fills in some of the gaps.
Reacted by Douglas GaldinoI didnt check, though It might be possible by importing the .so file in android and the respective on ios.
I suppose having it added in the init or readme, would bring some clarity.
I don't fully understand your request.
Are you asking for ways to load the prebuilds outside of the context of React Native?
No, in the context. But also in the native side.
Please elaborate more on your question, provide an example or add some other context. Ferric is meant to produce prebuilds for Android and iOS out of the box.
What do you mean by, "in case something is needed from it?"
That was badly written. Fixed.
I suspect this is mostly a case of missing examples and documentation. In its current form, loading the prebuild requires three things:
- The prebuild conforms with the format specified in docs/PREBUILDS.md.
- The app needs to configure Babel to use the Babel plugin (this requirement might be lifted when authoring libraries and not using existing packages with Node-API addons intended for Node.js):
plugins: ["module:react-native-node-api/babel-plugin"], - The app needs to require the addon (the test app does this here which in turn defers to the main field of the
ferric-examplepackage here which does a require of the addon prebuild from the generatedferric_example.js.
That seem to be steps for JS though, not actually use the rust native API in the android/ios side.
Rust > Android > JS > Android > Rust Rust > iOS > JS > iOS > Rustthis is somewhat what I previously meant, in case, it was needed.
Sorry 😔 I'm still not getting this. I'm genuinely curious, but I can't wrap my head around it.
Do you want to call into platform-specific native APIs (such as the Android SDK) from your Rust library code? Or do you want to load or call into your Node-API addon from native code (Java, Kotlin, Objective-C or Swift) - if yes for what purpose?
Can you speak a bit about the use-case? What are you trying to achieve here?
None at the moment, but I had some thoughts on building a library which could make use of this. But still not sure I will go forward with it. Some APIs from android or ios, might not be available on rust, so, some impl could end up needing a mix up.
Reacted by Kræn HansenI checked some information.
If the output supported multiple ABIs targets.
For android, in the most succinct way, would be something like.
rust_lib > dist > arm64-v8a > rust_lib.so armabi-v7a > rust_lib.so etc...In
build.gradleatandroid/app, addandroid { ... sourceSets { main { jniLibs.srcDirs = ["${rootDir}/rust_lib/dist"] } } }
For ios, not entirely sure yet, but likely to be with the
.podspecorPodfile.s.vendored_frameworks = '../../rust_lib/dist/rust_lib.xcframework'pod 'RustLib', :path => '../../rust_lib/dist/rust_lib.xcframework'
I suppose there is no real way to automate without specifying the settings.
Can't really comment meaningfully before I understand what you're trying to achieve.
But it does seem like you are painting the picture of what our host package is already doing while auto-linking.
- locked and limited conversation to collaborators
on Jul 30, 2025
Hey,
Is there a way to get ferric-cli / napi working with Android / iOS?