Hi and welcome back.
Today we're going to go over how to upload
our Android application to Google Play Store using Fastlane.
We're going to automate this process so
every new version that we have once we make changes to our application,
can be uploaded to Google Play Store using Fastlane
and just one command. For this,
we're going to have to set up Fastlane in our repository for Android as well.
We're still follow this donation.
If you haven't set this up for iOS, please make sure to open the link given
in the resources and run these three commands given here so that you're all
ready to get started with Android application deployment.
Now once you have that ready,
we're going to scroll down to the Android section and make sure that we have all
the prerequisites we need to start setting this up.
So first of all, we're going to need a Google Play Console admin account.
We already have that.
And just make sure that you are verified
before getting started, because unless you're verified,
this setup won't work and you're going to waste time watching this video.
Now let's continue.
So we need to create an application in the Google Play Console.
So let's do that.
Let's go to Google Play console.
I'm going to click on this link,
and here you're going to see that I already have some apps created.
This screen should be blank for you,
and the first thing that you're going to see is the Create Application button.
So just click on that and let's continue with creating our application.
I'm going to name this Altru donate as well as we did in the iOS version.
So I'm going to say that this is an application and it's going to be free.
And I'm going to accept all of the terms
and agreements, and I'm going to click on Create the Application.
Okay, so now you're going to see a bunch of tasks that we need to complete.
And let's start with setting up our testers.
I already have a group for the testers, and I created it and called it Myself.
It only has one email there, so make sure that you create one.
If you don't know how to create it, just click on Create email list.
I'm going to say that this is Myself 2.0, and you need to add an email address here.
So I'm going to add this email address here.
Click on enter. It's going to be shown right here.
And then click on Save changes.
Click on Create and the make sure to select this one.
And then just click on Save. Great.
So we can't create a new release yet.
So just let's discard this for a bit and go to our dashboard and start
completing our tasks to set up our application.
So there's a bunch of things that we need
to complete, and we're going to go through this super quickly.
So let's set privacy policy.
I'm going to set it to my website.
You can set it to your website,
but this actually will have to be a link to your privacy policy before you actually
release your application to the production.
So make sure that you set up some kind
of page on a website that refers to the privacy policy for your application.
But this will be enough for now.
I'm going to click on save
and then let's go to app access here and say that all functionality
in my application is going to be available without any access or restrictions.
And let's click on save.
Now let's go back and complete the ad
section and say that no, we don't have any ads in our application and save this.
Now let's go to the content rating and complete this questionnaire real quick.
I'm going to enter my email address here and then I'm going to say that it's not
a game, it's not a social or communication application, it's just other types of app.
And then I'm going to click on next.
These questions are mostly something
that you can answer with no, I'm not going to go through all of the right now.
I'm just going to click on an answer no to all of them and make sure that you read
these questions and when you have a different application that you're
deploying other than the donation application, we're uploading right now
that these answers actually match your application.
So I'm just going to say no to all of these right now.
No, I'm going to save it.
Click on next.
This was generated for me.
I'm just going to save it and great, this has been completed.
Let's go back to our dashboard and go
to target audience and say that everyone that's going to access our app is 18
and over so that we have no more questions asked and I'll say that it will never
appeal to children and I'm going to save this.
Now let's go back to the dashboard and go
to the news apps and say that no, we're not creating a news application.
And now let's go to COVID-19 contact tracing and status apps and say
that we're not tracing any kind of status for COVID-19 and then save this.
And let's go back to dashboard and do
the data safety questionnaire and say that we're not collecting any kind of data.
We technically are, but we don't want to answer too much questions right now.
I'm just trying to show you how to deploy
this application so you can answer these questions differently when you have
a different application that you actually want to publish to the world.
So let's go to government applications
and say that, no, we're not a government application.
Let's go back to the dashboard and then
let's say that we want to select an app category and provide contact details.
So just click on editing this section
and we're going to say that it's an app and category is going to be?
I don't know, let's say just Lifestyle
for now and click on Save and then close this.
And here we're going to need the contact details.
So let's input my email here.
You can enter your email,
and there's no other required information, so this should be sufficient.
And once we have that,
let's go back to the dashboard again and see what we have to complete.
And then we have to set up our store listing.
So here we're going to have the application name already displayed.
I'm just going to enter that
this is a donation application in the short description.
I'm going to inter some placeholder text
for now in the full description here, we're going to have to upload graphics.
And you can see attached files to this
video so that you don't have to get the graphics on your own.
So for now, just download those files.
I'm going to open the folder containing those files for myself.
And I'm going to upload the Play store icon here.
This Play Store icons was actually
generated by Make App icon that we use in the previous videos.
So I just grabbed it from there.
For the feature graphic, I just grabbed something from the Internet.
It's not really connected to our donation application
I just got something that's 1024 by 500 pixels.
So make sure that you have this whenever
you try to upload application using fast lane, because these are the prerequisites.
I'm just going to have these uploaded. Now, for the phone screenshots
you can literally take screenshots of your
application in the Android simulator whenever you have that open.
I already took two screenshots, so I'm going to drop them real quick here.
These are also attached to the resources of this lecture, so you can find it there.
And then these are not required because
we're actually not going to be supporting Tablet or Chromebook.
So I'm just going to click on Save here.
And we have most of the things that we need done right here.
So now let's go back to the documentation.
I'm going to close this.
And here we see that we have created the application in Google Play Console,
and now we need to use the git ignore file and place it inside the Android directory.
So I'm going to click on this,
and then I'm going to open our project in the webstorm editor.
You can also open your project in any editor that you like.
And here I'm going to just create a new
Git ignore file inside the Android folder as I suggested.
I'm going to create this file and call it Git ignore.
And then I'm going to just click on raw
here, copy these, and paste it here and save it.
Great. So now we have the Get ignore file inside
the Android directory, and we need to start setting up our Google credentials.
So now just follow me because we are going
to go a little different route than this outdated documentation, unfortunately.
So let's just go to Google Play Console.
I'm going to go here and I'm going to go to all of the applications.
And here in the setup section,
you're going to see API Access and just click on that.
Now let's talk about what API access is.
API access to Google Services enables developers to integrate Google Services
into their own applications, websites, or software solutions.
And by leveraging these APIs, developers can retrieve data,
perform actions, and interact with Google Services programmatically.
And to gain access to a specific
Google Service API, we typically need to obtain an API key or
credentials from the Google Developer Console.
And these key or credentials serve as
an authentication mechanism allowing us and our applications to make requests
to the desired APIs and access the associated resources.
And if we don't know how to do that,
there's a button here that says learn how to create service accounts.
Now we're going to need to go to Google Platform, and if you don't have
a Google Platform account, just create an account using the same
email address that you used for the Google Play Console
and I'm sure you can just login in with that address even.
So just go to Google Cloud Console.
And I already have some service accounts set up here,
but I am going to create a new one and I'm going to call it Altru Donate.
And then I'm going to click on Create and continue.
And I'm going to grant myself the owner
role so that I can do anything that I'd like with this API
and I'm not restricted anyhow.
I'm going to continue and I'm going to click on Done.
And once I do that, you're going to see this appear here.
And what I want to do is go to Manage Keys
and the Add a new key and create a JSON key and click on Create.
And that is going to be just downloaded directly to your downloads folder.
And we're not going to use it yet.
Let's just go to the API Access here,
click on Done, and once you click on it, this should auto Refresh.
But if it doesn't and you don't see your
key appear here, just click on Refresh Yourself and it's going to appear there.
Now, let's click on this button that says manage play Console permissions.
And then let's make sure that we have all of the permissions that we need.
And then let's go to Add permissions
and make sure that we add our Altru donate application here as well.
Let's click on Apply and Apply and let's
invite the user and then let's send the invite.
Now with this API access key,
we can connect to our application and create Deploys using the fast lane.
So now let's go to all of the applications and go to our Altru donate application
and we're going to come back to uploading a new version here soon.
Now it's time to start setting up our fastlane.
So for that let's go to terminal and let's navigate to our donation project.
It's called Donation App and actually it's inside the desktop.
So let me make sure I mentioned this.
And then I'm going to have to go to the Android folder and once I'm there,
I'm just going to clear my terminal so that you see what I'm doing clearly.
Okay, now let's run fastlane init command so that we initialize the fast
lane and let's say that our package name is com donation app vache and we don't
have the secret file and no, we don't need to download existing metadata.
That's okay.
Now let's wait for this to finish up and let's click on Enter.
Let's click on Enter and that's it, we're done.
Okay, so now once we have this, we're going to have to test our JSON key
and validate that it can connect to the Google Play Store.
So to do that actually I'm going to drag the downloaded JSON key file and place it
inside the Android folder and I'm going to click on Refactor.
That's fine. I'm going to add this to GitHub as well.
And then what I'm going to do is run a command here that is going to be called
fastlane run validate play store key,
JSON key and the JSON key path is going
to be let's make sure that we can get this name here.
I'm going to click on Rename and I'm just going to copy this and then I'm going
to reopen my terminal and I'm going to paste it here.
And then I'm going to click on Enter.
Okay, so we can successfully establish connection to Google Play Store.
And now we know that our JSON key file that we generated works.
Okay, so that's great.
Now we are going to need to generate
a sign in key which will allow us to set up a password for keystore and the key
for that we're going to have to find our JDK path where it's installed.
And to do that just run user and then libexec and then Java home.
Okay, so this will give you a path to where your JDK is installed.
So just copy this and once you do that, let's just go to this file.
So let's just do CD and then paste this
and we're going to change directory and we're going to get there.
So now we're inside the home folder
and here we're going to run this command given here.
So let's search for this and generate a signing key.
So just copy this and the just paste it here.
This will generate my release keystore file with the alias of my key alias.
So let's just click on Enter and then let's create some keystore password.
I'm going to enter mine.
You can enter yours.
By the way, when you're going to be
typing, you're not going to be string it and that's totally fine.
Your input is taken into consideration anyways.
And I'm going to reenter my password here
and I'm going to say that my first name and last name is Nata Vacheishvili.
And I'm not going to answer any of these questions, and I'm going to say yes here.
Okay, so this file has been created.
Now we're going to need to locate that file and actually move it to our project.
And that file will need to be moved to Android app folder given here.
So first we're going to have to locate this file, right?
Let's just copy the path to our JDK one more time.
And on your Mac just open the finder.
And once you open this, you can just click on Go and then go
to folder and the just paste this here and click on Enter.
Once you click on Enter, you're going to see my release key store generated here.
So just grab that file and more.
It inside the app folder of your Android directory and great.
So now this is added there.
I don't need this finder anymore.
And once we have this file, we're going to need to edit our Gradle Properties.
So let's go to Gradle Properties file.
This is directly inside the Android
folder, so just click on that and open that up.
And here we're going to set up some constants that we can use in our project.
So the first constant that we're going to set up is going to be for our store
file, which is a binary file that contains a private key used to sign the app.
It is typically created using the Java key tool that we just used.
So the store file should be kept secure
and backed up as it is required to sign future updates of the application.
So make sure that you don't commit this to your GitHub.
Okay, so now let's do my App upload store file.
And let's say that this is going to be my release keystore file.
Now we're going to need a second constant that is going to be my.
App upload key alias.
And we know that our key alias was set to MyKey alias here.
So let's just copy this and paste it here.
And then we're going to need some constants for our passwords as well.
So let's set up my app upload store password.
So these two constants are going to be
the passwords that you created in the terminal.
So let's create a second one called my app upload key password.
Great. Okay, so I'm going to set up my passwords
right now and you're not going to be seeing it.
Just enter your passwords as well and come back to the video.
Great.
So make sure that you have that file saved before continuing.
And now let's talk a bit about why we needed to set up signing at all.
So signing in the context of app development refers to the process
of digitally signing an Android application file using cryptographic key,
and the signing process ensures the integrity and authenticity of the app.
So now that we have all of our constants set up, we're going to have to go
to the build gradle file inside our application and start modifying it.
So here you see that we have the signing config set up for debugging purposes,
but we're going to be using Fast lane for releasing our application.
So we need to create a release signing config as well.
So let's just copy this and paste it here and modify this.
Okay, so I'm going to format this a little bit better.
And here in this store file,
I'm going to use our My app upload store file constant that we created together.
For the store password, we're going to use My app upload store password.
For the key alias, we're going to use our
Constants again and say that we're using My app upload key alias.
And then for the key password, we're going to use My app upload key password.
Great. Now let's save this.
And we're going to have to do one more thing.
Inside the build types here we have
the signing config for debug created, but for releasing.
We're not going to be using signing
configs for debug anymore because we just created the one for release.
Actually, let me rename this to release.
And here let's use the release signing config.
Great. So one thing I forgot in the last video
after editing all of our files was that I didn't change a folder name
for the release inside the source release here,
I only changed it for the debugging and main application.
So let's see the one here as well.
So this is called donation app vache.
But if I go to the release section, I want to rename this donation app
to match with donation app vache so that we have no problems.
And inside this react native flipper file, I want to make sure that the package
that we import here is also called donation app vache.
Okay, great. So now we can start preparing
for uploading our application on Google Play Store already.
The thing is that for creating the first
beta build, we have to upload it into Google Play console manually.
So we're going to have to do this manually
first, and then we can use fastlane to do this.
So for that, let's open a new terminal.
Let's go to the donation app Android file. Great.
I'm going to clear my terminal so that you see everything that I do clearly.
And what I'm going to do is use gradlew clean so that we start fresh
and we don't have any build caches missing with our release bundle.
Great.
So now what we need to do is run gradlew bundleRelease.
And this will generate an AAB file.
And this AAB file is something that we're going to use for our first release.
So we can already go to our dashboard.
And if this runs successfully, we're going to be able to create a new release.
This might take some time,
so you can wait for it and come back to the video once you're ready.
Great. So now our application has successfully
bundled up and if we go here, we're going to see a new folder appear
here called Build inside Android Directory App and then Build.
And if you open this up and open
the outputs and then Bundle and Release here, you're going to see App Release AAB
file, which is what we're going to use to manually upload the build of our
application inside the Google Play Console.
So let's create a new release and click on Create a new Release
and let's drop this file here and wait for the upload to complete.
Great. Now this is already uploaded so we can use
our release name and actually name it 1.0 and then click on Next.
Here you're going to see some warnings pop
up, but these are not important, so don't pay attention to this.
These are not errors.
We can still release our application.
So just click on save.
And now this is available to Internal Testers.
Now the next step is to make sure that we
can use Fastlane to upload our applications and our application since we
have only first release to internal testers is now in the Draft mode.
And to ensure that this is not
in the Draft node, what we're going to have to do is promote
the release to close testing and this will create alpha version of our application
and we're going to move from the Draft
mode to the alpha mode, which is something that we need to ensure
that we can use Fastlane for uploading our subsequent newer version.
So I'm going to click on this and submit it.
And here you're going to see errors and if
you don't resolve those errors, you're not going to be able to continue.
So let's see what errors we have.
First of all, our application has to target this and we
should declare the use of advertising ID in Play Console.
So let's complete the declaration and say
that we don't have any advertising ID and then save this.
Once you do that, let's go back to the App content.
Actually, we're going to have to go
to Dashboard ourselves and then close Testing
and let's click on Manage Track and go to our Draft Release and click on Editing
the release and let's click on Next again and go back here.
And now we have one more error that says
no countries or regions have been selected for this track.
So we're going to have to do that.
Let's go to the Dashboard again
and select the countries and regions and let's go to add countries and Regions.
And here I'm just going to select all of the countries and click on Save.
Great. Now let's continue editing our release
and click on Next and you're going to see these errors disappear.
And we only have four warnings here that we can also discard.
So let's just click on Save and great.
So now we are in the alpha mode.
We're not in the draft mode anymore.
Therefore, we can already start uploading our application using Fastlane.
So before we do that, there's one thing we have to do.
Let's go to the app file here and make
sure that we have the path to our JSON key file set up.
And let's make sure that we grab the name of this.
I'm going to click on Rename again, copy this name and paste it here.
Okay, let's save this.
And now let's go to our Fastfile.
And here you're going to see the deploy
lane, which is what we're going to use for deploying our application.
But instead of assemble release which generates APK files,
we need to write bundle release so that we generate AAB files because APK files are
not accepted by Google Play Console anymore because they have been deprecated.
So for upload to Play Store, we're going to need some arguments.
So let's create those.
Let's say that we are uploading our new build to the track that is internal.
Let's save this
and make sure also that our version is increased in our build gradle file.
Because if we don't increase the version,
then we're not going to be able to complete the deployment.
Every version that we're going to release will have to have its own version code
and version name that is unique compared to the ones that we have already uploaded.
So to do that, we're going to have to go
to the build gradle file inside the Android app directory.
And here you're going to see version code and version name.
Let's just change our version code to 2
and change our version name to 2 as well.
And this is something that you will always have to do manually, unfortunately,
before creating and uploading the build using fatlane. In the iOS,
this is handled automatically and it is incremented automatically,
but for Android, unfortunately,
you're going to have to do this manually every time.
Now I think that we are ready for our upload process.
So let's open a terminal.
We're inside the Android folder already. If you're not,
just navigate to the Android folder of your project and here just type
in Fastlane Deploy and click on Enter and wait for it to complete.
This will take some time,
so just be patient and come back to the video once you're done.
Great. So our Fastlane tools finished
successfully and our new version of the application has been uploaded using
automated deployment system that we just set up.
So if we go to the Altru donate application for the Google Play Console
website and refresh this page inside the internal testing tab,
you're going to see that you have 2.0 version available.
So if you want to deploy newer versions of your application.
After you make some changes, make sure to change the version code
and version name and update it and just do Fastlane deploy and it should complete
successfully and it will be inside the internal testing.
Now, if you're going to want to release this to production,
you're just going to go to production, create a new release,
and then you're going to add the builds from the library,
select the one that you want to release, name the release, click on Next,
and then you're going to submit it to the Google Play console for a review.
And you're going to have to select
the countries and regions for the production mode again.
But this is something easy to do.
You can just do it yourself.
But I'm not going to be actually submitting this to production.
I don't want to do that.
But this is how you are going to do it if you're interested.
Now, if you want to test this,
you're going to have to go to the testers tab and you're going to copy the link.
And if you go here, you're going to see the application.
Now we're not logged in from the actual phone, but if you were logged
in from the phone into the Google Play Store account using
the email that we set up here inside the Internal testers, you're going to be able
to download this application and actually test it on your device.
So if you're going to share this
application to your friends, just make sure that you have included
their email addresses here and that they are logged in with the same email address
in the Google Play Store account on their phone.
And once they go to this link that you can again find here inside the testers
and then copy the link here and send it to your friends, they're going to be able
to see this application and test it out on their real device.
And you can do so for yourself as well
and see how Altru donate looks on the actual device.
So this is it my friends.
I know we spent a lot of time setting this
up, but in the future it's going to save you a lot of time when you are going
to want to release new builds to the Google Play Store.
Plus, this setup is something important.
Many companies use it.
So if you're going to see your company use Fastlane, you're going to know how it
functions internally and why they needed it in the first place.
So that's all.
Thank you so much for watching and going through this tutorial.
I hope you find it useful.
Now your application can be deployed using
automated deployment system of Fastlane both on iOS and Android.
And this is a huge achievement and a big knowledge to be honest.
So good job to you and I'll see you in the next video.