0

I'm working on creating an npm module for use in react native that uses native java/ objective c libraries and I'm running into some trouble with android.

I'm following the react native documentation for creating native modules here: https://reactnative.dev/docs/native-modules-setup

Those steps are straight forward and I'm able to get my native code in place, run npm pack in the root directory of the module, npm install /path/to/module/package-0.1.0.tgz in the root directory of my project, cd ios && pod install and have the native ios module linked, running fine and accessible via NativeModule.

I start running into problems on the android side because the module doesn't appear with the rest of the packages, as far as I know everything should auto link and I shouldnt need any custom setup but non the less I've tried adding include ':custom-package' to settings.gradle, and even adding packages.add(new CustomPackage()); to MainApplication.java but of course it's unable to resolve my CustomPackage. Is there something I'm missing? Seems odd that android isnt working considering I'm using the built in create-react-native-library command.

1 Answer 1

1

Well not sure what I did wrong the first few times when I tried the above process but I tried again from scratch using the create-react-native-library and it worked perfectly, android module got auto linked and life is good again.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.