Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Build an Android React Native App for the Google Play Store or for Ad Hoc Distribution

    react-nativeReact Native
    javascriptJavaScript
    androidAndroid

    There are different steps to build an app for the iOS and Android app stores, so here we’ll look at how to build our completed app for Android. We’ll look at how to build a release for either ad-hoc installation, or for uploading to the Google Play Store.

    Code

    Code

    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In
    Discuss

    Discuss

    Transcript

    Transcript

    Instructor: Check to see if the keytool command is in your path by running keytool. On Windows you'll probably have to run it from program files Java than your jdkversion/bin.

    Then, generate a new signing key with keytool -genkey -v -keystore my-release-key.keystore -alias mykeyalias -keyalg RSA -keysize 2048 -validity 10000. Enter key password as well as the information about who is requesting the key. This will generate a 2048 bit RSA key that you want to make sure to keep private.

    It's also important to back up this keystore file and keep it secure, because if you ever have to change it, you'll have to rerelease your app and lose all the old downloads and ratings on the Play Store.

    Then, copy that file into the android/app directory. Add at the file android/gradle.properties. We'll paste in the following keys substituting in the correct values for the keystore that you just created.

    Then, add at android/app/build.gradle. First, check that the version code and the version name are set to the versions that you want to release. Now, add a signing config section under the default config.

    The build types release section add a signing configs line. Then, in our terminal cd into the android folder and build the app with ./gradlew assembleRelease which will build the production version of the app with the new signing key.

    Once that's complete, you can find the built APK file in android/app/build/output/apk/app-release.apk. That's the final file that you can distribute ad hoc to other android users to install directly on their devices, or upload to the Google Play Store to release to the public.