0
0
React-nativeHow-ToBeginner ยท 4 min read

How to Deploy a React Native App to Google Play Store

To deploy a React Native app to the Google Play Store, first generate a signed APK or AAB by creating a signing key and configuring gradle. Then, upload the signed app bundle to the Play Console, fill in the app details, and submit it for review.
๐Ÿ“

Syntax

Deploying a React Native app to the Play Store involves these main steps:

  • Generate a signing key: Create a private key to sign your app.
  • Configure Gradle: Add signing configs in android/app/build.gradle.
  • Build the app bundle: Use ./gradlew bundleRelease to create an AAB file.
  • Upload to Play Console: Submit your app bundle for publishing.
bash / groovy
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

// In android/gradle.properties
MYAPP_UPLOAD_STORE_FILE=my-release-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=your-store-password
MYAPP_UPLOAD_KEY_PASSWORD=your-key-password

// In android/app/build.gradle
android {
  signingConfigs {
    release {
      storeFile file(MYAPP_UPLOAD_STORE_FILE)
      storePassword MYAPP_UPLOAD_STORE_PASSWORD
      keyAlias MYAPP_UPLOAD_KEY_ALIAS
      keyPassword MYAPP_UPLOAD_KEY_PASSWORD
    }
  }
  buildTypes {
    release {
      signingConfig signingConfigs.release
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}
๐Ÿ’ป

Example

This example shows how to generate a signed app bundle and prepare it for Play Store upload.

bash
cd android
./gradlew bundleRelease

// The output AAB file will be at:
// app/build/outputs/bundle/release/app-release.aab
Output
BUILD SUCCESSFUL in 45s ... app-release.aab generated at android/app/build/outputs/bundle/release/
โš ๏ธ

Common Pitfalls

Common mistakes when deploying React Native apps to Play Store include:

  • Not generating or configuring the signing key properly, causing build failures.
  • Uploading unsigned or debug APKs instead of signed release bundles.
  • Forgetting to update versionCode and versionName in build.gradle, which Play Store requires for updates.
  • Not testing the release build on a device before uploading.
bash
/* Wrong: building debug APK for release */
cd android
./gradlew assembleDebug

/* Right: build signed release bundle */
cd android
./gradlew bundleRelease
๐Ÿ“Š

Quick Reference

  • Create signing key with keytool.
  • Set signing configs in gradle.properties and build.gradle.
  • Build release bundle with ./gradlew bundleRelease.
  • Upload app-release.aab to Google Play Console.
  • Fill app details, screenshots, and submit for review.
โœ…

Key Takeaways

Always generate and configure a signing key before building your release app.
Use the Android App Bundle (.aab) format for Play Store uploads, built with ./gradlew bundleRelease.
Update versionCode and versionName in build.gradle for each release.
Test your signed release build on a real device before publishing.
Upload your signed bundle to Google Play Console and complete all required app details.