Release version cannot use native module

I am using a native module with CRNA ejected with expo kit. App works fine with locally running XDE and react-native run-android command to kick start app on android device. However when i build the apk, the build version gets undefined in JS code wherever there is usage of native library. I did run react-native link again but no luck so far.

hi, did you fix the problem? I meet the same issue. :tired_face:

Hi @fantecy

The OP was using XDE and Expokit. Both of those are no longer supported. I suspect you are not using those.

So, could you explain what you want to accomplish and what you tried and what went wrong?

Thanks for your reply. Here is the problem, I eject my project and use jpush-react-native.It works fine when I use"yarn android" command.But when I use “expo build:android -t apk” to build an APK for my android devices, the build was success, but it seems that native module is not included in the package. (NativeModules.JPushModule is null)
Thanks again!

expo build does not support custom native modules. you must use the new service, eas build for that. Expo Application Services - Expo Documentation

As brents said you’ll need to use EAS Build.

Basically, you should build a custom dev client to use instead of Expo Go while you’re developing. And you can build an internal distribution version to allow others to download and test the app. When you’re ready to submit it to the App/Play stores you build a production version.

I am afraid I can’t read Chinese, but from what I can make out of their installation instructions you would still need to eject to use this package. It should be possible to write a config plugin to allow you to use it in the managed workflow. It might be worth asking them to write one so that in future other Expo users can use it without ejecting. (They would still need to use EAS Build and a custom dev client instead of the classic expo build and Expo Go.)

Thanks a lot. By using EAS Build I successfully build my project and jpush-react-native works fine :relaxed:

1 Like

It works, thanks a lot!

1 Like