Open ipinlnd opened 1 week ago
@ipinlnd can you share with me mainActivity and mainAplication please
@MohamedAbdElNaby This is my MainApplication class
class MainApplication : NavigationApplication() {
override val reactNativeHost: ReactNativeHost =
object : NavigationReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
add(SafeAreaContextPackage())
add(IntentsPackage())
}
override fun getJSMainModuleName(): String = "index"
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)
override fun onCreate() {
super.onCreate()
// SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
}
}
There isn't much in my MainActivity class related to this.
@ipinlnd
If you comment out the line:
SoLoader.init(this, OpenSourceMergedSoMapping);
the app should function correctly without any issues.
@MohamedAbdElNaby Yeah so that is currently commented out. So I don't have that in my local code at all.
However, the NavigationApplication makes a call to SoLoader.init(this, false);
and for me, that caused me to see a crash on app start with the error that it couldn't find the libhermes_executor.so
which leads me to believe that the reason was this. I made a patch for it and updated the call to pass OpenSourceMergedSoMapping
as the second param and it worked fine.
It seems to be a new thing in react-native 0.76 (https://reactnative.dev/blog/2024/10/23/release-0.76-new-architecture#android-apps-are-38mb-smaller-thanks-to-native-library-merging)
@ipinlnd can i share with you my project to detect what is the problem in my code i invite you to my project can you help me in this please ?!
@ipinlnd did you find any solution to the issue? I’ve tried to the NavigationApplication
’s line to SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE);
, but it fails with this error:
> Task :react-native-navigation:compileReactNative71DebugJavaWithJavac FAILED
/Users/ofer.morag/hibob-mobile/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java:38: warning: [removal] enableFabricRenderer in ReactFeatureFlags has been deprecated and marked for removal
setIsFabric(ReactFeatureFlags.enableFabricRenderer);
^
/Users/ofer.morag/hibob-mobile/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java:111: warning: [removal] ReactViewBackgroundDrawable in com.facebook.react.views.view has been deprecated and marked for removal
if (view.getBackground() instanceof ReactViewBackgroundDrawable) {
^
/Users/ofer.morag/hibob-mobile/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java:112: warning: [removal] ReactViewBackgroundDrawable in com.facebook.react.views.view has been deprecated and marked for removal
return ((ReactViewBackgroundDrawable) view.getBackground()).getColor();
^
/Users/ofer.morag/hibob-mobile/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java:27: error: unreported exception IOException; must be caught or declared to be thrown
SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE);
^
/Users/ofer.morag/hibob-mobile/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java:237: warning: [removal] onCatalystInstanceDestroy() in NativeModule has been deprecated and marked for removal
public void onCatalystInstanceDestroy() {
^
/Users/ofer.morag/hibob-mobile/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java:242: warning: [removal] onCatalystInstanceDestroy() in NativeModule has been deprecated and marked for removal
super.onCatalystInstanceDestroy();
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
5 warnings
@oferRounds You need to put it in a try/catch for IOException I believe.
error: unreported exception IOException; must be caught or declared to be thrown
thank you, just found it a minute before you wrote! Thank you for your fast response!
What happened?
With the release of the new React-native version (0.76), we need to call the
SoLoader.init()
function with a new SO Mapping object for loading libraries.Currently the NavigationApplication class makes a call to
SoLoader.init(this, false);
which overwrites any calls we make in our own application code. So our builds are failing.This needs to update to
SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE);
Was it tested on latest react-native-navigation?
In what environment did this happen?
React Native Navigation version: 7.40.3 React Native version: 0.76.1