Get #Amazon #Prime for this #holiday #amazonprime #christmas #2019

#ReactNative - How to build and upload your app to #GooglePlay?

How to upload a React Native app to Google Play - Alpha, Beta or Production

  1. Test your app using Jest and make sure it runs on your phones or simulators.
  2. Go to package.json to edit app version, description, author etc if it hasn't been done yet.
  3. Go to app.json file to update the description if needed.
  4. Generate signed APK. Detailed steps(step 5-12 can be found here on React Native site.
  5. On linux based OS, run this command to generate a signing key. It will prompt you for some information such as password.
    keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
  6. Place the my-release-key.keystore file under the android/app directory in your project folder.
  7. Edit the file ~/.gradle/gradle.properties or android/gradle.properties and add the following (replace ***** with the correct keystore password, alias and key password)
    Make sure your keep the following information securely. If not, you will have to remake your keystore.
    MYAPP_RELEASE_STORE_FILE=my-release-key.keystore 
    MYAPP_RELEASE_KEY_ALIAS=my-key-alias 
    MYAPP_RELEASE_STORE_PASSWORD=***** 
    MYAPP_RELEASE_KEY_PASSWORD=*****
  8. Then, edit the android/app/build.gradle in your project folder and add the signing config:
    ...
    android {
        ...
        defaultConfig { ... }
        signingConfigs {
            release {
                if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                    storeFile file(MYAPP_RELEASE_STORE_FILE)
                    storePassword MYAPP_RELEASE_STORE_PASSWORD
                    keyAlias MYAPP_RELEASE_KEY_ALIAS
                    keyPassword MYAPP_RELEASE_KEY_PASSWORD
                }
            }
        }
        buildTypes {
            release {
                ...
                signingConfig signingConfigs.release
            }
        }
    }
    ...
  9. Note that to reduce APK size by architecture, set the following line in android/app/build.gradle file as true.
    def enableSeparateBuildPerCPUArchitecture = true
  10. Then, in your root app folder, run this command to build:
    cd android && ./gradlew assembleRelease
  11. You can test your release build by running this command:
    react-native run-android --variant=release
  12. The generated APK(s) can be found via this path:
    android/app/build/outputs/apk/app-release.apk
  13. Create a Google Play Developer account by paying some fee.




    Google Play Developer account
    Google Play Console











  14. Prepare graphic assets. The following seems to be the minimum needed now. 
    Screenshots

    Default – English (United States) – en-US
    JPEG or 24-bit PNG (no alpha). Min length for any side: 320px. Max length for any side: 3840px.

    Hi-res icon

    Default – English (United States) – en-US
    512 x 512
    32-bit PNG (with alpha)

    Feature Graphic

    Default – English (United States) – en-US
    1024 w x 500 h
    JPG or 24-bit PNG (no alpha)
  15. Prepare a privacy policy if you app requires sensitive permission or users' information such as  Camera, Contacts,  Location, Microphone etc.
    You can see the list of normal and dangerous permissions here on Android site.
    You can use Google Sites or a GitHub gist to host it.
  16. Besides filling out the app's description in Store listing section, there are three other sections that you have to take care of. They are Content rating, Pricing and distribution and App releases.
  17. When you have check marks for all these 4 sections, you can proceed to release your app.


  18. Go App releases to add your APKs that you built. 
  19. To release your app, at App release section, scroll down to bottom and click Review.
  20. If you have filled out all 4 sections, you will be able to upload your App to Google Play. 
  21. If the button 'Start Rollout To Production' is greyed out, that means some of the sections are not completed. Refer to the image above. Green check mark means good to proceed.
  22. Follow the instructions and provide all the information needed.
  23. You are all set to upload your App to Google Play app store. Yay!
Note:
1) 
command node error message
A problem occurred starting process 'command 'node''

If you get the above error: A problem occurred starting process 'command 'node'',
It is probably you have your Android Studio open as it launches with custom env variables and thus can't node in your PATH.
Check out this GitHub issue for more information. 

2) 
When you are ready to release a new build, you have to increase Android version code in your build.gradle at android/app/build.gradle and AndroidManifest.xml at android/app/src/main/AndroidManifest.xml
Check out Android document
Android build Version Code
Android build.gradle Version Code

Android versionCode
Android Manifest Version Code


Thank you for reading!

Jun