Android Library from React Native

--

This guide assumes:
- React Native project was created following React Native CLI Quickstart
- Maven installed

Creating the Android library project

From Android Studio, create an Android project (no-activity template), name it “AndroidLibrary” and save it inside the react-native project.

For the purpose of this guide let’s clean the created AndroidLibrary:
- remove folder: app/src/main/res
- remove folder: app/src/test
- remove folder: app/src/androidTest

Update AndroidManifest.xml, build.gradle, and app/build.gradle

build.gradle
app/build.gradle

Create MyReactActivity to make it easy for other activities to use the React components.

Doing the plumbing …

- Bundle react-native project for android
- Copy react-native bundle and resources to AndroidLibrary
- Build and generate artifacts for AndroidLibrary
- Copy dependencies to maven

Use AndroidLibrary in the Android project

app/build.gradle

--

--