Ejected Expo, React Native, can't find libreactnativejni.so - react-native

I've got an Ejected Expo project, that's getting the following error while trying to run on Android.
I'm aware there's lots of documentation on this issue but all seem focused on 64bit binaries being included. I've unzipped the APK that's generated and the lib folder only contains :
/x86
/armeabi-v7a
So if there is a 64Bit include, I cant see where it would be?
Any suggestions?
2019-06-02 17:32:27.725 6202-6280/com.projectName.dynamic E/SoLoader: couldn't find DSO to load: libreactnativejni.so
2019-06-02 17:32:27.727 6202-6280/com.projectName.dynamic E/AndroidRuntime: FATAL EXCEPTION: Thread-3
Process: com.projectName.dynamic, PID: 6202
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:703)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:564)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:500)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:455)
at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:18)
at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:19)
at com.facebook.react.bridge.JSCJavaScriptExecutorFactory.create(JSCJavaScriptExecutorFactory.java:21)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:914)
at java.lang.Thread.run(Thread.java:764)

Related

Why does this error appear when building release build and causes crash but not with emulator or usb debug?

I am having an issue where the application that is build using ./gradlew bundleRelease (aab) or ./gradlew assembleRelease (apk). At the moment when user clicks the application it crashes straightaway and this issue doesn't happen on emulator when building the application using npx react-native run-android or using the real device through usb debugging.
In the google play developer console I got the following error that shows up
FATAL EXCEPTION: create_react_context
Process: com.vahingonsattuessa, PID: 18803
java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:248)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:277)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1408)
at com.facebook.react.ReactInstanceManager.access$1200(ReactInstanceManager.java:138)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1104)
at java.lang.Thread.run(Thread.java:764)
And
java.lang.RuntimeException:
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets (Native Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets (CatalystInstanceImpl.java:248)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript (JSBundleLoader.java:29)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle (CatalystInstanceImpl.java:277)
at com.facebook.react.ReactInstanceManager.createReactContext (ReactInstanceManager.java:1408)
at com.facebook.react.ReactInstanceManager.access$1200 (ReactInstanceManager.java:138)
at com.facebook.react.ReactInstanceManager$5.run (ReactInstanceManager.java:1104)
at java.lang.Thread.run (Thread.java:923)
Any ideas why this happens and how would I be able to fix this?
The same here. I don't know why. I already ammend the build.gradle adding
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
root: "../../",
entryFile: "index.js",
cliPath: "node_modules/haul/bin/cli.js",
devDisabledInAppDev: true,
devDisabledInAppTest: true,
devDisabledInRelease: true,
bundleInAppDev: true,
bundleInAppTest: true,
bundleInRelease: true,
]
But, didn't work yet. Even after this fix I'm getting the crash.
I keep going looking for the issue.

React Native Android debug build crashes on launch, iOS works fine

I'm trying to launch a fresh react-native init app,
launching with react-native run-android
Build passes, the APK is installed on a device, but it crashes on launch.
The logcat shows:
06-13 10:09:50.467 11106 11106 W System.err: java.lang.ClassNotFoundException: host.exp.exponent.ReactNativeStaticHelpers
06-13 10:09:50.469 11106 11106 W System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "host.exp.exponent.ReactNativeStaticHelpers" on path: DexPathList[[zip file "/data/app/com.dummy-o3c6RDZQ-kC_ECVFF6RNOQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.dummy-o3c6RDZQ-kC_ECVFF6RNOQ==/lib/x86, /data/app/com.dummy-o3c6RDZQ-kC_ECVFF6RNOQ==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
06-13 10:09:50.470 11106 11106 E unknown:ReactNative: Bundle url format is invalid.
06-13 10:09:50.470 11106 11106 E unknown:ReactNative:
06-13 10:09:50.470 11106 11106 E unknown:ReactNative: java.net.MalformedURLException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
What's particularly interesting is I'm not using Expo on this project, but the error shows couldn't find host.exp.exponent.ReactNativeStaticHelpers, along with Bundle url format is invalid.
When ran on another Mac, it runs completely fine.
I've tried reinstalling react-native-cli, whole Android Studio and tools/SDK's, tried to run on multiple devices (both emulators and physical devices) to no avail.
- Most probably the problem is with the caching of this library as you were previously using expo:
Both of expo and react-native facebook libraries are similar in naming but different in code.
Expo:
https://github.com/expo/expo/blob/sdk-33/android/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java
React-native:
https://github.com/facebook/react-native/blob/0.60-stable/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java
Solution:
Remove the Facebook folder from "/home/$user/.m2/repository/com/facebook" then sync the project again to re-download the correct library.

React-Native: _reactNativeFacebookLogin.FBLoginManager.loginWithPermissions is undefined

Im trying to implement this Facebook-SDK for React-Native.
I followed the steps in the README guide but cannot get it to Work.
Every time i try to log in with Facebook I get the following error message:
EDIT: Im running the a signed APK
EDIT2: The error does only happen with the signed APK - what could that mean?
undefined is not a function (evaluating '_reactNativeFacebookLogin.FBLoginManager.loginWithPermissions')
Unable to symbolicate stack trace: Bundle was not loaded from the packager
FATAL EXCEPTION: mqt_native_modules
Process: com.solopro.dogwood, PID: 5018
com.facebook.react.modules.core.JavascriptException: undefined is not a function (evaluating '_reactNativeFacebookLogin.FBLoginManager.loginWithPermi
ssions'), stack:
facebookLogin#76454:62
touchableHandlePress#52180:39
_performSideEffectsForTransition#21343:26
_receiveSignal#21259:38
touchableHandleResponderRelease#21033:20
invokeGuardedCallback#15044:12
executeDispatch#14877:38
executeDispatchesInOrder#14900:16
executeDispatchesAndRelease#14354:42
executeDispatchesAndReleaseTopLevel#14365:35
forEachAccumulated#15179:12
processEventQueue#14527:19
runEventQueueInBatch#15204:33
handleTopLevel#15215:21
<unknown>#14147:39
perform#16143:16
batchedUpdates#31745:20
batchedUpdates#15373:32
_receiveRootNodeIDEvent#14146:28
receiveTouches#14208:48
__callFunction#7706:28
<unknown>#7613:22
guard#7564:3
callFunctionReturnFlushedQueue#7612:6
at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:90)
at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:78)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:319)
at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:187)
at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:62)
at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:432)
at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:135)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:193)
at java.lang.Thread.run(Thread.java:818)
Maybe this is even a known issue.
UPDATE:
The error is pointing out the function "loginWithPermissions" which is not even available in the android package of react-native-fbsdk but only in the iOS package.
I have no idea why this function is being used.
I am using LoginManager.logInWithReadPermissions(['public_profile', 'email']).then(...) for the FB-Login
Most likely the questioner had overcome this issue.
Sometimes, if some Facebook libraries (like fbjs/lib/invariant) are used in development process, the related lines must be marked as comment line before building the release apk.

java.lang.IllegalAccessError on launch of react native activity in release mode

I have added one React Native screen to my existing android project.
Copying the proguard settings related to react native from
https://github.com/facebook/react-native/blob/master/local-cli/generator-android/templates/src/app/proguard-rules.pro WORKS.
However I want to enable obfuscation for my project and hence commented out the line -dontobfuscate
After this, when I deploy the release build in my nexus device, I get this error :
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
Process: com.sampleapp, PID: 2463
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat.<init>()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule' (declaration of 'com.facebook.react.modules.netinfo.NetInfoModule' appears in /data/app/com.sampleapp-1/base.apk)
at com.facebook.react.modules.netinfo.NetInfoModule.<init>(NetInfoModule.java:55)
at com.facebook.react.shell.MainReactPackage.createNativeModules(MainReactPackage.java:67)
at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:793)
at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:730)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:5091)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
This link does mention obfuscation isn't supported in React-Native:
https://github.com/facebook/react-native/issues/7530
I want to obfuscate existing app code.

Can't use SpeechKit Titanium module from iOS in my app

I want want to use Speechkit SDK in my app, since I found it recognize words better than the native tool did.
I found a Titanium module on GitHub but it is designed to work with Titanium SDK 3.1.3.GA . I am currently working with SDK 5.0.0.GA.
What am I supposed to do to import this module in my mobile app ? I updated the titanium.xcconfig file to reflect the version of my SDK. I also put my credentials into it and build the project. Then I compressed it and installed it via Help Menu > Install Mobile Module. I finally added it to the tiapp.xml file.
When I try to run the project, this is what I get :
[ERROR] : ** BUILD FAILED **
[ERROR] : The following build commands failed:
[ERROR] : Ld Build/Intermediates/Hello5.build/Debug-iphoneos/Hello5.build/Objects-normal/arm64/Hello5 normal arm64
[ERROR] : Ld Build/Intermediates/Hello5.build/Debug-iphoneos/Hello5.build/Objects-normal/armv7/Hello5 normal armv7
[ERROR] : (2 failures)
TRACE | titanium exited with exit code 1
ERROR | Error: ti run exited with error code 1
at ChildProcess.<anonymous> (/Users/feeder/.appcelerator/install/5.0.1/package/node_modules/appc-cli-titanium/plugins/run.js:89:66)
at ChildProcess.emit (events.js:117:20)
at Process.ChildProcess._handle.onexit (child_process.js:820:12)
I tried to create a new module by hand and drag-and-drop files into it, and also tried to install globally vs project-specific, I can't come with an idea for making it work. Thank you in advance if you could share an idea ;)
I have the same error and looking the console using Trace appears "framework SpeechKit not found".
I've successfully resolved this error by packaging the module to your project directly selecting "Mobile App Project" given that Module.xcconfig sets "FRAMEWORK_SEARCH_PATHS" to find SpeechKit framework on "assets" folder from the project directly.