Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load RNOneSignal native module. Make sure native dependencies are properly linked. #1345

Closed
4quarenta opened this issue Jan 14, 2022 · 26 comments

Comments

@4quarenta
Copy link

4quarenta commented Jan 14, 2022

Hi there,

when I try to OneSignal.setAppId('APP_ID'), I get this error:

Could not load RNOneSignal native module. Make sure native dependencies are properly linked.
at node_modules\expo\build\logs\LogSerialization.js:156:14 in _captureConsoleStackTrace
at node_modules\expo\build\logs\LogSerialization.js:41:26 in serializeLogDataAsync
- ... 9 more stack frames from framework internals
@rgomezp
Copy link
Contributor

rgomezp commented Jan 14, 2022

Howdy,
Are you using Expo?

See the RN troubleshooting guide.

@4quarenta
Copy link
Author

RNOneSignal

I didn't find anything about this error, I even followed all the steps and I keep getting the same error

image

@rpaggi
Copy link

rpaggi commented Jan 17, 2022

Same error here
image

@rgomezp
Copy link
Contributor

rgomezp commented Jan 18, 2022

Please follow the issue template so I can help you better.

Are you using Expo?

@4quarenta
Copy link
Author

Please follow the issue template so I can help you better.

Are you using Expo?

Yes

@rgomezp
Copy link
Contributor

rgomezp commented Jan 19, 2022

That's the problem. If you want to use Expo you need to use the OneSignal Expo Plugin or eject into the bare workflow.

See this discussion thread for more info.

Cheers

@rgomezp rgomezp closed this as completed Jan 19, 2022
@Adlai-1
Copy link

Adlai-1 commented Jun 11, 2022

Still doesn't work...

@brunolcarlos
Copy link

Same error

"dependencies": {
    "expo": "~44.0.0",
    "expo-device": "~4.1.0",
    "expo-file-system": "~13.1.4",
    "expo-media-library": "~14.0.0",
    "expo-splash-screen": "~0.14.1",
    "expo-status-bar": "~1.2.0",
    "expo-system-ui": "~1.1.0",
    "expo-web-browser": "~10.1.0",
    "onesignal-expo-plugin": "^1.0.2",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-device-info": "^9.0.2",
    "react-native-navigation-bar-color": "^2.0.1",
    "react-native-onesignal": "^4.3.11",
    "react-native-reanimated": "~2.3.1",
    "react-native-safe-area-context": "3.3.2",
    "react-native-web": "0.17.7",
    "react-native-webview": "11.15.0"
  },

Could not load RNOneSignal native module. Make sure native dependencies are properly linked.
at node_modules/react-native-onesignal/dist/helpers.js:15:8 in isNativeModuleLoaded
at node_modules/react-native-onesignal/dist/index.js:286:29 in __generator$argument_1
at node_modules/react-native-onesignal/dist/index.js:33:17 in step
at node_modules/react-native-onesignal/dist/index.js:8:13 in
at node_modules/react-native-onesignal/dist/index.js:4:11 in
at src/pages/Home/index.js:33:8 in useEffect$argument_0
at node_modules/react-native/Libraries/ReactNative/renderApplication.js:58:4 in renderApplication
at node_modules/react-native/Libraries/ReactNative/AppRegistry.js:117:25 in runnables.appKey.run
at node_modules/react-native/Libraries/ReactNative/AppRegistry.js:202:4 in runApplication

@Lucashb
Copy link

Lucashb commented Jul 11, 2022

Someone fix this ?

@4quarenta
Copy link
Author

Someone fix this ?

I managed to solve using the specific plugin for expo:

https://github.com/OneSignal/onesignal-expo-plugin

@alicanso
Copy link

alicanso commented Sep 6, 2022

even your example project is same. need fix

@gpolanco
Copy link

Has anyone found a solution to the problem?

@mohammad6vakili
Copy link

Someone fix this ?

@badinenisaivardhan
Copy link

Just Include this code In andriod/settings.gradle
include ':react-native-onesignal'
project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android')

clean npm and gradlew
npx react-native clean
npm install --save
npx react-native run-android

@gpolanco
Copy link

Just Include this code In andriod/settings.gradle include ':react-native-onesignal' project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android')

clean npm and gradlew npx react-native clean npm install --save npx react-native run-android

I have seen that solution, but I have to eject project and I don't want

@badinenisaivardhan
Copy link

badinenisaivardhan commented Oct 26, 2022

Just Include this code In andriod/settings.gradle include ':react-native-onesignal' project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android')
clean npm and gradlew npx react-native clean npm install --save npx react-native run-android

I have seen that solution, but I have to eject project and I don't want

if you are using RN above code will work... because i am moving my code from expo to RN, today and it is working fine...!
if u are using EXPO: onesignal-expo-plugin (https://github.com/OneSignal/onesignal-expo-plugin) use this..

@HamzaKV
Copy link

HamzaKV commented Nov 17, 2022

Seems like latest version(1.2.0) of onesignal-expo-plugin does not seem to work with latest version(4.4.1) of react-native-onesignal as I get the same error.

@davidcort
Copy link

Just Include this code In andriod/settings.gradle include ':react-native-onesignal' project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android')

clean npm and gradlew npx react-native clean npm install --save npx react-native run-android

Thanks, this works.
I started my project with expo, after I run expo run:android.
Install one signal, this problem occurs after that.
I add the code in the settings gradle.
clean yarn and gradle.
run npx expo run android
Sucess !!

@mohammad6vakili
Copy link

Seems like latest version(1.2.0) of onesignal-expo-plugin does not seem to work with latest version(4.4.1) of react-native-onesignal as I get the same error.

So what should we do now?

@mohammad6vakili
Copy link

I don't want to eject my app. what should I do? OneSignal Expo Plugin doesn't work !!!

@HamzaKV
Copy link

HamzaKV commented Nov 28, 2022

I used react-native-onesignal version 4.3.3 with version 1.2.0 of onesignal-expo-plugin. It did give me build errors on Android, but I resolved it using expo prebuild.

Seems like latest version(1.2.0) of onesignal-expo-plugin does not seem to work with latest version(4.4.1) of react-native-onesignal as I get the same error.

So what should we do now?

@MehmoodAlam632
Copy link

Please follow the issue template so I can help you better.

Are you using Expo?

Yes

@trinityblade
Copy link

I had the same error show up when launching the app on Expo Go. After chatting to OneSignal support, this is their response below (long story, short: this error will only show up when launching the app on Expo Go. The final build tested on your native device will work just fine)
"Are you building this app through Expo Go? if so, you will not be able to run on Expo Go since it doesn't come with the native dependencies required by OneSignal. You can think of the config plugin as adding some custom native code to your application. To get those native changes into your build, Expo needs to bundle it into a custom client that includes those changes. Think of it as building your own Expo Go app to run the application. Since the Go app is prebuilt, it will not include any native customizations. That is why this does not work."

@Madhusankamsk
Copy link

Did you fix the issue for Expo

@nusendra
Copy link

I managed to make it work in Expo. Just follow this steps

https://documentation.onesignal.com/docs/react-native-expo-sdk-setup

The most important part is you guys need to run npx expo prebuild. Then run the app with emulator npx expo run:android. Unfortunately, this is not working with real device (yarn start)

@3moz
Copy link

3moz commented Mar 18, 2024

I managed to make it work in Expo. Just follow this steps

https://documentation.onesignal.com/docs/react-native-expo-sdk-setup

The most important part is you guys need to run npx expo prebuild. Then run the app with emulator npx expo run:android. Unfortunately, this is not working with real device (yarn start)

This worked for me.

In other words:
npx create-expo-app app_name [any flags]
<follow .../react-native-expo-sdk-setup>
npx expo run:android

I don't think i ran npx expo prebuild but that doesn't appear to have blocked except my run:android might've taken longer to build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests