- Prerequisites
- Getting Started
- Running the application
- Commiting the code
- Creating new and independent packages
- Most common errors
- Solutions
- Tips
- References
- Follow the instructions from the React Native Dev Env Setup
- You need to install
git-czglobally for when you commit the code.
yarn global add git-czOr
npm i -g git-czRun the following command to install all the dependencies in the right location
yarn
yarn core:build:wThis will build the files in the core directory and it will be ready to use. All changes to the files in the core directory will be "watched" and those changes will be reflected wherever these files are being consumed.
yarn web:dev# to run the metro server
yarn metro # after this, we build the application
yarn pod-install
yarn ios# to run the metro server
yarn metro # after this, we build the application
yarn android-
Change the
applicationIdproperty ofdefaultConfiginsideandroid/app/build.gradle. -
As per convention, the package name inside
app/src/javashould match the applicationId. In order to achieve that, do the following:- Open the
androidfolder inside android studio. - Expand
app/src.
For
maininsideapp/src- Expand
main. - Right click on
javaand chooseNew > Package. - Enter the
applicationIdand press⏎. - Select all the java files under the previous
applicationIdpackage and drag them under the newly created package.
For
debuginsideapp/src- Expand
debug. - Repeat steps 4-6.
- Open the
-
Open
android/app/src/main/AndroidManifest.xml. -
Change the
packageattribute on line 2 to the newapplicationId. -
Open
android/app/src/main/res/values/strings.xml. -
Change the
app_namestring value to the desired name.
- Open
mobile.xcworkspaceinside XCode. - Press the project navigator icon.
- Click on the
Generaltab. - Change the display name to the desired name in the Display Name input field.
- Change the bundleID to the desired id in the Bundle Identifier input field.
- Click on the
Build Settingstab. - Search for
PRODUCT_NAME. - Double click on the value to start editing.
- Type the value of the display name and press
⏎.
cd packages/mobile/android
./gradlew assembleReleaseThe generated APK will be at packages/mobile/android/app/build/outputs/apk/release/app-release.apk
This repository follows commit guidelines provided by commitizen. To verify the installation of commitizen, you can run git cz.
After staging the files that you have changed, instead of using git commit, use git cz. This will give you an interactive shell with the help of which you can draft your commit message.
In order to create a new and independent package(NOT inside packages directory) which is managed inside the monorepo, do the following:
- Add the name of the independent folder inside the
workspacesfield at the root levelpackage.jsonand in thepackagesfield inlerna.json. - To create module inside the new independent package, run the following command:
yarn lerna create <name-of-module> [name-of-independent-package]Note: The independent packages in this folder are:
packageslinters
Check package.json and lerna.json for reference to the above.
- Version mistmatches in
package.jsonin all the packages. All the dependencies should have the same verison - Wrong node modules path in the mobile app native ios and android configs.
- While building ios,
react-nativedirectory won't be found inmobile/node_modules - Android builds might fail because of gradle versions
tried to synchronously call function from a different threadconfig["reactNativePath"] not working- Emulator process not killed (Windows)
- Application Building Issues for android
- Release build application crash on iOS
- Make all versions the same and use lerna to manage the installation of
node_modules - Rectify all
node_modulepaths inside the native ios and android configs - Make sure that all the paths for react native in the Podfile have been changed and then run
npx pod-install - Do the following in case of failed builds:
- Go to
android/gradle/wrapper/gradle-wrapper.properties, and change the value ofdistributionUrltohttps\://services.gradle.org/distributions/gradle-6.7.1-bin.ziplike thisdistributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip - Download JDK 11 and set your
$JAVA_HOMEvariable to JDK 11
- Go to
- Refer to yarn-workspaces-reanimated repository for the setup
- Follow this solution
taskkill /F /IM "qemu-system-x86_64.exe" /T- Fix
node_modulespaths inproject.ext.rectinsideapp/build.gradle - Add
#ifdef DEBUGbefore#ifdef FB_SONARKIT_ENABLEDon line 7 and 30.
- To get a list of emulators; run this command:
emulator -list-avds - To increase performance of emulator; run this command:
emulator -gpu host -feature HVF -avd <name-of-avd-from-list>- If you want to change the JDK version in android studio: answer for this