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.
Instructor: [00:00] 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.
[00:12] 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.
[00:51] 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.
[01:02] 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.
[01:22] 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.
[01:36] 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.
[01:57] 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.