13 steps to Deploying React-Native
Android App to Google Play Store using Android Studio
a concise list of deployment steps with the assumption that :
- Android Studio is installed and that
- your native project is set up already through `react-native init YourProject` and contains the android folder with build/gradle files
*TIP: if for some reason, the below steps don’t seem to work, try to reset all the project dependencies
1. deleting the package-lock.json file and node-modules folder;
2. then re-install node modules using `npm install`.
First off, react-native has very good documentation to follow, with possibly just the difference of few android studio configurations out of it.
Make sure you follow the documentation to generate Keys that will have to be used for every release and match across all the versions :
- In android/app/build.gradle (Module: app) in defaultConfig object increment versionCode and versionName only.
*make sure that other settings in defaultConfig (such as applicationId) and all of the signinConfigs (such as keyAlias, keyPassword, and others ) stays the same through-out the versions of the app as they are cross-referenced: if something doesn’t match, the app does not get uploaded.
2. After build version is changed you need to sync build.gradle file with project:
- go to File > Sync Project with Gradle Files
- Go to Build > Rebuild Project
3. Check that Run Settings have the device set up:
4. OPTIONAL step if default run options don’t work for an odd reason. In the Run configuration make sure to :
- Set Activity to com.yourProjectName.MainActivity
- Target a USB Device or Emulator
- In ‘Before launch’ section set Gradle-aware Make as the first setting before any other
5. in your emulator/physical USB device make sure any old app version are uninstalled/deleted as this often produces conflicts when building new version on the device
6. To rebuild, first, start rebuilding the JSX part (react-native code).
Make sure the following command opens a terminal process window (and previous terminal processes are closed ). From project root, in your terminal run ‘react-native run-android --variant=release’.
*Variant=release notes production setting. you can change those to ‘-- variant=debug’
if successful to 100%, this generates app-release.apk file, you can find it at android/app/build/outputs/apk/release/apk-release
*potential source of confusion: android studio build generates a different app-release.apk file and stores it in a different location, make sure you find the right one :)
7. now go to play.google.com/apps/publish console, press CREATE APPLICATION, or ‘Manage’ existing application to update
8. go to Release management > App releases > Alpha or Beta or Production section, press `create release/edit release`.
9. Upload the app-release.apk from the correct folder (react-native generates one, android studio generates one as well, but in a different locations, see step 6)
choose Alpha, Beta or Production sections. You can always ‘upgrade’ alpha into Beta, into Production.
10. give reason for release of new version description between the <en-GB> </en-GB> tags at the bottom of page
11. ‘Save’ and then ‘Review’ .
If it is a totally new app and ‘Review’ is deactivated for no apparent reason:
12. Fill out store presence, copyright and other tabs with grey circles untill the sections reach publishable (green circle) status.
And that’s it! Android doesn’t review the apps as Apple do, so you would see the alpha/beta/production app ready in 22–30 min. Good luck ! :)