loading .so file react-native - react-native

I'm trying to load a .so file with my react-native project using the Native Modules.
I'm loading the library with the LoadLibrary func and i am not able to envoke the funtions inside.
However, i have opened a regular java project in android studio and i was able to load the library perfectly.
Any ideas?

I had the same problem and what worked for me was adding this two files where is the MainActivity.java class. You have to change the package name of both classes to com.solo_test
1- https://github.com/CassieLuoli/react-native-smartconnection/blob/master/android/src/main/java/com/luoli/smartconnection/SmartConfigHelper.java
2- https://github.com/CassieLuoli/react-native-smartconnection/blob/master/android/src/main/java/com/mediatek/demo/smartconnection/JniLoader.java
don't forget to change de name of the library on JniLoader.java class
Finally you need to invoke SmartConfigHelper.init(); in MainActivity for load the library

Related

How to create react native wrappers for native android and iOS SDKs

I am creating a React Native module as a wrapper for existing Android and iOS libraries. The Android library is a jar file and the iOS library is xcframework file. I put the xcframework file inside the ios folder, and the jar file inside android/libs folder ( I created the libs folder). I first tried the iOS library by adding s.preserve_path, s.xcconfig and s.vendored_framework inside the project level podspec file. I am not sure if I need to do anything for the pod spec file, like running it. So I just went along with the next step by trying to import the library's .h in .m file. I tried both using angle brackets <> and using quotes "". But none worked, because firing "react-native run-is" gave me this error: fatal error: file not found. Any help on how to include the libraries in react native is greatly appreciated.
For creating react native wrapper or node module you need use below library.
https://www.npmjs.com/package/react-native-create-library
https://github.com/brodybits/create-react-native-module
Using this library you can create empty react native module project after that you can bind your native code ARR or framework files into that project.
I was able to fix the error by doing the following two steps:
Change "s.vendored_framework" to "s.vendored_frameworks" in the project level .podspec file. My original one is singular (framework), not plural (frameworks).
cd iOS && pod install && cd ..
Step 2 can be found in create-react-native-module's GitHub link:
https://github.com/brodybits/create-react-native-module
I missed the second step when posting my question. I thought then that if I ran "react-native run-ios", it would run "pod install".

Error while importing local native module package

I'm new to React Native as such i need some help with a rather interesting problem. I'm trying to create a native module library to wrap some native ios/android api's. I followed some examples on the react site to do this but the issue i'm running into is how to package my created module so i can import the code into another react native app.
This is the error i'm running into while trying to use my newly created module.
TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[7], "simple").DeviceModule.increment')
I create the package via npm pack, it generates a .tgz file which i attempt to install into my sample app via npm install but the end result is the error message above.
When attempting to use the module in my code i use the following: import { DeviceModule } from 'simple'; and this generates a warning:
Could not find a declaration file for module 'simple'. '/Users/aqureshi/Projects/React/ScanForensicsDemo/node_modules/simple/index.js' implicitly has an 'any' type. Try npm i --save-dev #types/simple if it exists or add a new declaration (.d.ts) file containing declare module 'simple';ts(7016)
So i'm not sure where to go from here, also worth mentioning that I created the native module via another RN "App" project, because when i try to create a library via create-react-native-library it would not work either.

Why are some .h files missing when compiling wbrtc_ios as a framework?

I am new to WebRTC stuff. I cloned the webrtc_ios main branch, and I built the framework as instructed here with the python script for arm64. When I add this to my Xcode project as a framework, everything is fine. Project builds, I can import files using <WebRTC/...> syntax.
However, I need to use RTCMTLRendeder.h file. Building a framework with python script leaves some of the header files out. (When I take a look at WebRTC.h inside the built framework, I can see that this file is missing) How can I include all header files that actually exist inside /webrtc_ios/src/sdk/objc/components folder while building the framework? I can see RTCMTLRenderer.h and .mm files are in that folder before using the build script. When turned into a framework those files don't exist inside the framework anymore. Why? And is there any other way to actually copy those files into the project as well?
Turns out you need to create your own, long renderer class which does not inherit from RTCMTLRenderer at all if you want to render on Metal view manually in a Swift/ObjC hybrid project (at least this is how I solved it). That class does whatever RTCMTLRenderer does, and grabs pixel buffers from RTCVideoTrack through an RTCVideoView.

Custom path to my iOS xcworkspace/xcproj file

How can I specify where my native iOS project is? Because my iOS project is in subfolder of ios folder. For example ios/myProject.
If you check code for local-cli code which responsible for command react-native run-ios, you can see that it runs a function called findXcodeProject which takes a path argument. This path argument is hard coded in the project so I don't thing there is an option to change the default behavior unless you change the source code. You can fork and submit a PR if you think this is a required behavior for the project.

Visualworks mcz packages import with Monticello

I'm trying to program a client for multitouch gestures using TUIO under SmallTalk/Visualworks.
In order to get the mcz package for TUIO, I'm using Monticello.
The problem is that whenever i try to load a package with Monticello, i always end receiving this error message :
I can show you the Stack if anyone is inerested in it.
Thank's in advance.
A mcz package is essentially a compressed zip file. The current implementation of Monticello in VisualWorks uses external shell programs to uncompress and compress the source code to a Monticello mcz file.
When porting packages from Monticello to VisualWorks under Windows, there is usually a problem finding the corresponding zip.exe/unzip.exe. To solve your problem, try to set your PATH variable to your zip.exe/unzip.exe.
Another approach is to download the Info-ZIP package from the web. Place it into a subfolder in the image directory and change the execution logic of the VisualWorks Monticello Package. Browse for senders of shOne: in the VisualWorks Monticello Package and change the call.
The next thing to keep in mind when porting packages from Squeak or Pharo is to always define a Namespace which is named extactly after the first word of the monticello package name (upTo: $-). Define the namespace before loading the package.
i.e. JQueryMobile-Libraries-NickAger.10.mcz -> Define a Namespace JQueryMobile
Don't forget to import necessary Namespaces that the imported code requires to resolve the superclass names.
i.e. JQueryMobile needs Seaside.*, Javascript.*, JQuery.*, Grease.*, Smalltalk.*