Steps to compile your android app using react native

Prerequisites

  1. Check your repository and its versions.
  2. Check JDK version on your system.
  3. Use JDK11, it is necessary to compile your app.
  4. Either set you JAVA_HOME to JDK11 location or install new one.
  5. Update you node js to latest (currently v18).
  6. Check your android and android sdk locations.
  7. To check JAVA_HOME & ANDROID_HOME (for MacOS)
  8. Check your version in
    1. android – build.gradle
      1. buildToolsVersion = “30.0.2”
      2. minSdkVersion = 31
      3. compileSdkVersion = 31
      4. targetSdkVersion = 31
      5. kotlinVersion = “1.3.72”
      6. classpath ‘com.android.tools.build:gradle:4.2.0’
      7. classpath ‘com.google.gms:google-services:4.3.13’
  9. Keep your app version equal in following files
    1. package.json
    2. android/app/build.gradle

 

Steps to follow

  1. Open your react native repo in vs code.
  2. Open terminal/git bash for better view.
  3. Locate the terminal path to your project folder.
  4. Install the package manager to your folder.
  5. You can use NPM or YARN (I would suggest YARN).
  6. Run the following command to install the package manager.
  7. Check your repo and check whether node_modules is added or not.
  8. To upgrade react-native run following
  9. To update, lottie-react run following
  10. Now run the following command to compile your repo
  11. After compiling, run the following command to prepare your app
  12. Now run the following command to prepare a bundle file, which you need to upload to the Google console to publish your app.

 

Updated on Oct 07, 2022