react-native-screens: TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[11], "react-native-screens").ScreenStack')

Description

Error

Error: Requiring module “node_modules/react-native-screens/src/index.tsx”, which threw an exception: Error: Exception in HostObject::get(propName:RNSModule): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.app-MOOsrlTZxxpxhwDiZsIz2g==/base.apk”],nativeLibraryDirectories=[/data/app/com.app-MOOsrlTZxxpxhwDiZsIz2g==/lib/arm, /data/app/com.app-MOOsrlTZxxpxhwDiZsIz2g==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]] couldn’t find “librnscreens.so”

Another Error

TypeError: undefined is not an object (evaluating ‘_$$_REQUIRE(_dependencyMap[11], “react-native-screens”).ScreenStack’)

This error is located at:
    in NativeStackViewInner (created by NativeStackView)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by SafeAreaProviderCompat)
    in SafeAreaProviderCompat (created by NativeStackView)
    in NativeStackView (created by NativeStackNavigator)
    in PreventRemoveProvider (created by NavigationContent)
    in NavigationContent
    in Unknown (created by NativeStackNavigator)
    in NativeStackNavigator (created by Navigation)
    in ErrorBoundary (created by ErrorBoundary)
    in ErrorBoundary (created by Navigation)
    in RNGestureHandlerRootView (created by GestureHandlerRootView)
    in GestureHandlerRootView (created by Navigation)
    in Navigation (created by OptimizedComponent)
    in OptimizedComponent
    in Unknown (created by OptimizedComponent)
    in OptimizedComponent
    in Unknown (created by App)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by App)
    in PersistGate (created by App)
    in Provider (created by App)
    in NetworkConnectivity (created by NetworkProvider)
    in NetworkProvider (created by App)
    in _QueryClientProvider (created by App)
    in _QueryClientProvider (created by _PersistQueryClientProvider)
    in _PersistQueryClientProvider (created by App)
    in App (created by CodePushComponent)
    in CodePushComponent
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in APP(RootComponent)

Dependecies:

"dependencies": {
    "@hookform/resolvers": "^3.3.4",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-native-community/blur": "^4.4.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^9.3.6",
    "@react-native-picker/picker": "^2.6.1",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/native-stack": "^6.9.17",
    "@react-navigation/stack": "^6.3.20",
    "@reduxjs/toolkit": "^2.1.0",
    "@tanstack/query-async-storage-persister": "^5.22.2",
    "@tanstack/react-query": "^5.20.5",
    "@tanstack/react-query-persist-client": "^5.22.2",
    "@types/metro-config": "^0.66.0",
    "appcenter": "^5.0.1",
    "appcenter-analytics": "^5.0.1",
    "appcenter-crashes": "^5.0.1",
    "axios": "^1.6.7",
    "i": "^0.3.7",
    "i18next": "^23.8.1",
    "metro-config": "^0.72.3",
    "moment": "^2.30.1",
    "moment-timezone": "^0.5.44",
    "npm": "^10.4.0",
    "react": "18.1.0",
    "react-hook-form": "^7.49.3",
    "react-i18next": "^14.0.1",
    "react-native": "0.70.10",
    "react-native-aws3": "^0.0.9",
    "react-native-bootsplash": "^5.5.3",
    "react-native-bundle-splitter": "^2.2.3",
    "react-native-calendars": "^1.1303.0",
    "react-native-code-push": "^7.1.0",
    "react-native-config": "^1.5.1",
    "react-native-date-picker": "^4.3.5",
    "react-native-device-info": "^10.12.0",
    "react-native-element-dropdown": "^2.10.1",
    "react-native-error-boundary": "^1.2.4",
    "react-native-gesture-handler": "2.8.0",
    "react-native-google-places-autocomplete": "^2.5.6",
    "react-native-image-picker": "^7.1.0",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-maps": "^1.10.0",
    "react-native-modal": "^13.0.1",
    "react-native-offline": "^6.0.2",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-picker-select": "^9.0.1",
    "react-native-reanimated": "~2.2.0",
    "react-native-safe-area-context": "^4.8.2",
    "react-native-screens": "^3.29.0",
    "react-native-sensitive-info": "^5.5.8",
    "react-native-svg": "^14.1.0",
    "react-native-svg-uri": "^1.2.3",
    "react-native-toast-message": "^2.2.0",
    "react-native-vector-icons": "^10.0.3",
    "react-redux": "^9.1.0",
    "react-uuid": "^2.0.0",
    "redux": "^5.0.1",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^3.1.0",
    "rn-fetch-blob": "^0.12.0",
    "yup": "^1.3.3"
  },
  "devDependencies": {
    "@babel/core": "^7.23.9",
    "@babel/runtime": "^7.23.9",
    "@react-native-community/eslint-config": "^3.2.0",
    "@tsconfig/react-native": "^3.0.3",
    "@types/jest": "^29.5.11",
    "@types/react": "^18.1.0",
    "@types/react-native": "^0.70.10",
    "@types/react-native-vector-icons": "^6.4.18",
    "@types/react-test-renderer": "^18.0.7",
    "@typescript-eslint/eslint-plugin": "^7.2.0",
    "@typescript-eslint/parser": "^7.2.0",
    "babel-jest": "^29.7.0",
    "eslint": "^8.57.0",
    "eslint-config-prettier": "^9.1.0",
    "jest": "^29.7.0",
    "metro-react-native-babel-preset": "^0.77.0",
    "prettier": "^3.2.5",
    "react-native-bundle-visualizer": "^3.1.3",
    "react-native-dotenv": "^3.4.11",
    "react-native-svg-transformer": "^1.0.0",
    "react-test-renderer": "^18.2.0",
    "typescript": "^5.3.3",
    "visualize-bundle": "^1.4.0"
  },

Steps to reproduce

  1. yarn install or yarn
  2. yarn android or npx react-native run-android

Snack or a link to a repository

here it is

Screens version

3.29.0 3.30.0+ - Since we’ve started using C++ layer from 3.30.0 version, original suggestion is probably incorrect. ~@tboba

React Native version

0.70.10

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 28 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Started having the same problem couple days back. Looks like the latest version (3.31.1) has that problem. You have “react-native-screens”: “^3.29.0”, try without ‘^’. Seemed to fix it for me right now.

Hello 👋🏻 here come some conclusions

The error:

Error: Requiring module "node_modules/react-native-screens/src/index.tsx", which threw an exception: Error: Exception in HostObject::get(propName:RNSModule): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.app-MOOsrlTZxxpxhwDiZsIz2g==/base.apk"],nativeLibraryDirectories=[/data/app/com.app-MOOsrlTZxxpxhwDiZsIz2g==/lib/arm, /data/app/com.app-MOOsrlTZxxpxhwDiZsIz2g==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]] couldn't find "librnscreens.so"

Is indeed triggered by not present libscreens.so shared object and the fault is on library side, in particular these lines in our build.gradle which basically means that unless you are on React Native 0.71 or newer it won’t be build, resulting in this runtime crash.

This issue is an oversight on our side as we should either change compatibility note or add some checks for RN version in runtime to avoid loading the dll into JVM.

Workarounds

If it is feasible in your situation / application you can upgrade React Native to 0.71 or newer and this should resolve the issue.

Another option is temporary downgrade and wait for fix on our side, however note that we are unsure yet on how to proceed with this issue (some technical constraints) and it might take a while. 3.29.0 should be the last unaffected version.

Started having the same problem couple days back. Looks like the latest version (3.31.1) has that problem. You have “react-native-screens”: “^3.29.0”, try without ‘^’. Seemed to fix it for me right now.

I was facing the same problem, but removing the ‘^’ from “react-native-screens”: “^3.29.0” in package.json file solved the issue. Thank you @kristensala for providing the solution.

I’m having the same (or a similar) issue.

Error: Exception in HostObject::get for prop 'RNSModule': java.lang.UnsatisfiedLinkError: dlopen failed: library "librnscreens.so" not found, js engine: hermes

ERROR TypeError: Cannot read property 'ScreenStack' of undefined

@tboba Yup. Android NDK is the problem. Solved. Thanks

Started having the same problem couple days back. Looks like the latest version (3.31.1) has that problem. You have “react-native-screens”: “^3.29.0”, try without ‘^’. Seemed to fix it for me right now.

I was facing the same problem, but removing the ‘^’ from “react-native-screens”: “^3.29.0” in package.json file solved the issue. Thank you @kristensala for providing the solution.

use this version “react-native-screens”: “3.0.0”,

For me its working after downgrading it to 3.0.0.

Thanks

reactNativeArchitectures value in gradle.properties is

reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64

Hey, we’ve found better way to handle this issue => should be solved with next release.

@kabundege I removed the If/else around ndkVersion and just added the ndkVersion = "26....." It can have a bit of a snowball effect after. You might have to update other packages and/or react-native version itself

I’ve just checked provided reproducer with a slight modifications:

  • I’ve removed appcenter-related dependencies, since I was unable to run my examples with them
  • I’ve updated React Native to 0.70.15 version

Unfortunately, I still cannot reproduce this error. However, given the information that the error comes from librnscreens.so, I’ve got two suspicions there:

  • Could you check which version of Android NDK do you have installed? In my case, I’m using 26.1.10909125, but newer versions should be good to go aswell. That should be the first thing you should check 👍
  • If you’re trying to use react-navigation’s native-stack, are you trying to use goBackGesture prop? If so, please keep in mind that this prop is still not introduced there, since the PR with adding the API to native-stack is still open. For now, you can stick with the native-stack v5 (if possible).

I’m having the same (or a similar) issue.

Error: Exception in HostObject::get for prop 'RNSModule': java.lang.UnsatisfiedLinkError: dlopen failed: library "librnscreens.so" not found, js engine: hermes

ERROR TypeError: Cannot read property 'ScreenStack' of undefined

did you solve the issue?, I have the same problem.