React Native β Installation
Read Checklist before releasing your app
Be sure to carefully read Release Checklist when releasing your app. It's critical to make things right from the first attempt!
Currently, React Native offers two ways of development flows: Expo and "pure". Adapty can work with both. Please, refer to the only one section below that matches your setup.
Expo (managed)
You can avoid local builds with EAS, configuration may vary depending on your setup, but here you can find the most common and simple setup.
0.1. If you don't have EAS CLI yet, install it with following command
npm install -g eas-cli
0.2. Then in the root of your project install dev client to make a development build
expo install expo-dev-client
- Run the installation command:
expo install react-native-adapty
- iOS: Make an iOS build with EAS CLI. This command may prompt you for an additional info. You can refer to official documentation to find out more.
eas build --profile development --platform ios
- Android: Make an Android with EAS CLI. This command may prompt you for an additional info. You can refer to official documentation to find out more.
eas build --profile development --platform android
- Start a development server with the following command.
expo start --dev-client
This should result into the working app with react-native-adapty.
Failed to start (Invariant Violation: Native module cannot be null)
if you scan QR code from CLI dev client it might lead you to this error. To resolve it you can try the following:
On your device open EAS built app (it should provide some Expo screen) and manually insert URL that Expo provides (screenshot below). You can unescape special characters in URL with JS functionunescape(βstringβ)
, which should result into something likehttp://192.168.1.35:8081
Pure React Native
If you prefer a pure workflow. refer to following instructions:
- In your project run the installation command:
yarn add react-native-adapty
- iOS: Install required pods:
pod install --project-directory=ios
- Android: Update
/android/build.gradle
file. Make sure there is akotlin-gradle-plugin:1.6.21
dependency or newer:
...
buildscript {
...
dependencies {
...
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
}
}
...
- Android: Update
android/app/build.gradle
file. Make suremultiDex
is enabled:
...
android {
...
defaultConfig {
...
multiDexEnabled true
}
}
Updated 5 months ago