Now you learned how you can build your app for iOS,
what about Android?
Again and the official React Native docs, under guides, Android,
you find instructions on how to publish your app to the Google Play Store and
in the end, you can just follow the instructions you find here.
It all starts with creating such a keystore which I already mentioned in the expo managed workflow
but there expo did that for us on their servers,
here we need to do that and we can do this inside of our project or on Windows as it says here,
make sure to run this command while navigating in this folder. You can copy your keystore into your
project thereafter or store it anywhere else.
You will need that keystore which is generated for signing your app and for signing updates to the
app,
so make sure you don't lose it
otherwise you'll not be able to rebuild your app or update your app.
So here, you can enter an arbitrary password what you want to choose and then some information about
you which technically could be wrong but which should be correct kind of since this is your identifier
with instance, since this is used for assigning your app in the end
and once you entered all this and confirmed it and you chose your passwords, this now creates this my
upload key keystore file here and now you can use that to sign your application. Next you need to set
up some gradle variables as you see here and for that make sure you move the key storage to the Android
app folder,
so from this folder here, move it up into Android and there into the app folder so that the file is there
and then go to the gradle properties file, the Android gradle properties file. So here, under Android
we have the gradle properties file and in there,
you can add these entries and as it says there, replace the stars here with the password you chose for
the keystore.
Once you did that, you can close that file,
you should go to the Android app build gradle file, so not build gradle here but in the app folder
and there the build gradle file and add this configuration in the Android node as you can see. So you can
just copy this and then here, search for the Android node which is this node,
there you got the default config what you should not touch
but you got your sign config where you should in the end add this release part,
so not delete the debug part but add this release part and then under build types release,
add this line here.
So if we scroll down further, build types release, there we can add this line, signing config release and now you
can generate your APK with these command,
so by navigating into the Android folder and then by running this command. So let's do that,
let's first of all navigate into the Android folder here with cd android and then run this gradle
w command
and this should now build your app and sign it for production and give you such an app bundle in the end
which you can then upload to the Google Play Store.
So let's wait for that to finish and once this build succeeded, you can actually take that app bundle
which you now find under app build generated
outputs bundle, this file here, that's your release bundle, that's what you can upload to the Google Play Store.
For that, you can search for Google Play console and you need a Google Developer account for that which
also costs you money
but unlike Apple's program, it's not a subscription, it's a one-time fee of $25 and here
in the Google Play console, you can now create a new application once you're logged in with your paid
account, choose an app name like this, create it and then here you can manage your entire store appearance
or entire app how it looks like and under app releases,
there you can click on production track, production manage, create a release there and now here
you need to upload your app bundle. Now you can click continue here with the default settings normally but
in general, I would recommend that you dive into the Google Play Store or Google Play console documentation
to learn all about the things you can set up here but in the end, this is now where you can upload the
bundle which you built.
So here, you would upload this bundle file and thereafter, you can finish up your store appearance and
you can publish your app in the Google Play Store as well.
Now of course you might wonder, how do you add icons and so on because I haven't touched on this yet?
A convenient and easy way of doing that is with the help of Android Studio.
There, you can open an existing Android Studio project and open your Android folder in your React Native
project here with Android Studio, just the Android folder, not the entire React Native project. In there,
you'll find your Android part of this project and here to add icons, you can go to the app folder, source,
main, res and there
wait for this initialization and the build to finish which starts up oce you open this and once this initialization
is done, in that app folder if you click on the res folder, right click on it, you can select new and
there, image asset and this opens an editor where you can conveniently add and generate new image assets,
new icons for example. There you can choose launch your icons, adaptive and legacy
and now what you can do, you can leave the name,
you can setup your icon, you can configure it there. You can choose a foreground layer and there, you
can for example choose the path of an image you want to use, a background layer where you can set a solid
color or also an image you want to use in the background and then therefore generate your
icon with that tool. Simply click finish and of course provide your own image there if you want to and
it will set everything up for you to have a nice icon which of course is pretty sweet. Now regarding
how to customize the splash screen, attached you find some documentation on how you may do this on Android
to set your own splash screen. Of course whenever you change your icons and/or your splash screen, you
will need to rerun this build with that gradle w command and then also redeploy your new app bundle
to the Google Play Store with the Google Play console and with that, this is how you would build and
deploy React Native only apps. Of course a bit more manual work, a bit more cumbersome than in the expo
managed workflow but now you know both options and you can go for whichever approach you need for
your application.