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.