In this course, we will examine the interface of Android Studio and explore the Gradle Build system, manifest files, and resources such as strings, drawables, etc.
This course is ideal for anyone who wants to learn how to use Kotlin for developing applications on Android.
This content will take you from a beginner to a proficient user of Kotlin and so no prior experience with the programming language is required. It would, however, be beneficial to have some development experience in general.
Well, hello friends. So, in this lesson, when we install the Android Virtual Device, that is the Emulator, it will allow us to test the applications that we make. So, let's get started. I know you're ready. So, first we'll open up Android Studio. For Android Studio, you can create a shortcut to the desktop or you could pin it to the taskbar. So, this way you're going to open it well, quicker, easier, whatever you like. So, let's create a new project. To create a new project, we've got to select the 'New Project' option from here.
And as from this section, I will select the 'Phone and Tablet' and the 'Empty Activity' option. I'll press the 'Next' button. Now in this window, we can configure our project, so let's do that. Project name may be 'My Android Project'. And of course you could give it any name that you want, but just remember what it is. Now, from this section, you can change the 'Package name' of your project or it can stay that way for now. I'm not going to change the file path where the project will be saved.
But if you do need to change it, you can just click on the 'File' icon here, select the file that you want to save then after specifying the file path, remember to write slash and project name at the end of the file path. See the programming language will be common. And the minimum SDK, well, that's got to be 23 and then finally I'll create my new project just by clicking the 'Finish' button. So, when you open your project Android Studio is going to show you a little tip and the tip window contain, tips of the day. So, you can read it but I usually just check the 'Don't show me no tips' box and well, I just don't want this window to open up every time. You are more than welcome to have it open every time, give you a tip, okay? Now, we have to wait for a project to be fully created. We should not take any action before our project is completely created though. Well, just let it happen. So, now our project has been created successfully. And before moving on to the emulator installation, I would like to talk just a little bit about one more thing.
In order to use the emulator, the virtualization technology must be enabled on your computer. Now most new computers have this technology enabled by default. It may not be enabled on some AMD processors, but you might as well find out, right? So, just go ahead and look in your task manager. I'm just typing here 'Task Manager' in the search bar. Open up task manager and I'll open the performance tab and there's all kinds of information here but as you can see it appears that there is Virtualization Enabled. So, if virtualization technology doesn't happen to be enabled on your computer, you've got to do this by accessing the computer's BIOS menu. Shouldn't be too difficult opening the menu may differ though between different computers, depending on so many different things. So, by examining the document, I will add after this lesson. Please remind me to do that. Now, you don't have to, you have already done it. You can have the information about opening your BIOS menu. Or, you know what? As a result of a simple search on the Internet according to the brand and model of your computer, you can find out pretty quickly.
But I don't want to prolong this any further. You just have to know, okay? Now probably the majority of you have this feature enabled still just need to point it out. You can also access detailed information about emulator installation by examining the link that I will also leave under this lesson. So, why don't we just get to the emulator installation? So, we can now start the setup of the Android Virtual Device. So, it's an Android Studio to create a virtual device or to start an existing virtual device. We need to click the 'Phone' icon on the top right of the interface. So, notice when I move the mouse cursor over to the phone icon, AvD Manager appears. So, if you click on this 'Phone' icon, the AVD Manager window opens. Also you can open the AVD Manager by selecting the 'Tools' from the menu bar and selecting the 'AVD Manager' option here. So, with these two different ways, you can open the AVD Manager window. And the window shows our virtual devices.
Of course, since I've created two virtual devices before these virtual devices appear. Here, for me, as I currently do not have any Android Virtual Devices, no virtual devices are shown in this window. You may see one virtual device on your screen by default, but it doesn't really matter because we're going to create a new virtual device together right now. So, to do that, I will click the 'Create Virtual Device' button right here to create the virtual device. So, this button may appear at the bottom of your left screen and when you click it, a window opens like this. So, there's a first step in creating this virtual device. Now, on the left of the window that opens, you're going to see a number of categories. As you know the Android operating system is an operating system that can be used in televisions, phones, watches, tablets, even cars. You should choose a category according to which platform you're going to make your application for, right? So, since we're going to be making applications that can run on the phone, I'm going to choose the 'Phone' option. Later on, we'll see phones built by Google. You can choose any virtual device here. However, it may be better if you choose any of the devices with the Play Store application installed. That way we're going to be able to produce an application and there may be some things that we have to do in the Play Store to do different things with the applications. Just giving you a heads up
there. Now, I usually choose the devices that have the play store application already installed. You can also see the size of the resolution of the virtual devices from here. What else? So, taking these features into account, you can choose pretty much any virtual device. I generally prefer the Nexus 5x virtual device because both the play store application is installed and the resolution in size are ideal. So, after selecting the Nexus 5x virtual device, I'll press the 'Next' button and down here bottom right. So, when we click on the 'Next' button, the window with android versions opens. Now at this point we can determine which version of android that we want to have installed on a virtual device.
You know what I mean? The most current version right now is Android 11 or Android R, my friends. So usually, we are going to select the most current version, but you can download other versions as well. In fact, to download any version, just click the 'Download' option right here. So, as soon as you click it, the download will start automatically. And this process may take a little while so I'm just going to stop screen recording and when the download is complete, we'll pick up right where we left off. All right my friends the download's complete. So, I press the 'Finish' button. That's the version of the android that we downloaded will be installed on your virtual device. So, now after downloading the Android 11 version, we'll just press the 'Next' button again. This step is the last step of the process of creating a virtual device in case you're wondering. You can also name your virtual device from this window that opens up. However, we usually use virtual devices with the default name here. You might know why? You can also specify the 'Startup orientation' of your virtual device from here. And we can also choose the 'Portrait' option in general. That's what I'll do.
And we can now create a virtual device by clicking on the 'Finish' button. So, as you can see our virtual device has been created. Now at this point in time I will show you how you can delete a virtual device that you've created from before. So, we click on the 'Gray Triangle' at the end of the line here where each virtual devices shown. Clicking it opens some views. An if you select the 'Duplicate' options, you can create a copy of your existing virtual device. If you choose to 'Delete' option at the bottom, you will completely delete that virtual device that you've created. And if you choose a 'Wipe Data' option, are you going to delete all the data on your virtual device? Sometimes we can use this option because as we develop projects and test them on our virtual device, the size of the virtual device on the disk increases and begins to slow down. So, if you ever get stuck in that situation, you might just want to clean out your virtual device. So, why don't we run our virtual device right now? To launch the virtual device, simply press the 'triangle' that looks like the play icon here. And by clicking this 'triangle', you're going to launch the virtual device. Now again, this process may take some time my friends. All right. So, at this stage you just got to be patient. Don't skip any steps. But as you can see the virtual device is just like a real phone. Of course, installation process takes a really long time. So, I'm going to speed up this part a little bit so that the duration of our lesson doesn't extend beyond what's for real. All right, cool. So, our virtual device is now turned on.
So, firstly let's log into the Play Store using our email address. So, I'll press the 'Sign In' button. And you can write your email address in the field here. So, after typing your email address, just click the 'Next' button. Next up, we need to accept the Google Play terms of agreement. And we must also accept the rules of Google services. As you can see, we can now access the application we want from here just as if we open the Play Store application on a real device. I still trip out on it. Of course, I explained these steps for you right now, but that's cool. It's not really necessary to know about for your application development,
but for me I like to know where I'm going. Also, I really don't recommend installing and running any application from the Play Store on your virtual device just in case you're tempted because, well, the virtual device kind of works slowly, it's really not for that. There's really no need to slow down by installing more apps anyway. So, why don't we take a brief look at some of the other features of your virtual device? You can turn on your emulator device on and off using the power button here. You can increase or decrease the volume of the device.
You can take the phone in portrait or landscape mode. So, here you can see the back, homepage, and overview buttons. And look at this by pressing the 'More Option' here we can access other features. Yeah, you can use maps here and here again, you can see cellular battery status. From here you can access the camera of your virtual device. So again, there's an area where you can make virtual calls.
Now of course, we're not going to be using these features throughout this course but I'm just showing you because it's kind of fun to have a tour. So, let's close this window now by pressing on the 'X' in the upper right corner. And from here, if you swipe up with your mouse you can access the apps on the phone. So, that's the installation of the virtual device. There you go, now you know. Now, how can we run our project, the one that we're going to make on a virtual device. Well, there is an answer to your very good question. First of all, we can minimize our virtual device by clicking the 'Minimize' icon here. Now, in future when we're having our lessons we're going to make some applications and we'll need to test these applications right here on the virtual device. So, notice here we see the virtual device that we have just completed in the setup. If we had more than one virtual device or if we connected to real android device, we would be able to see all of the devices here.
Now, which device you're going to want to test your application on, you should you choose that device. Make sense. Since we only have one virtual device, for now I'll just choose a Nexus 5X device and just press the 'Green Triangle' icon here to run the application and test it out. If you want let's add a button to the design area before testing the project. All right. So, first we'll click on the 'Eye' icon here and from here let's select the 'Show System UI' option. So, the design area will look like a real phone screen.
So, now let's delete the text view component here. For this after selecting the text view component, you can just press the 'Delete' key on the keyboard or you can select the 'Delete' option after right clicking with the mouse. So, now let's add a button to the design area. I select the 'Button' component from the Palette and drag it to the design area. You don't need to do this I'm just showing you how to test the project on a virtual device because you're going to get there believe me. So, we will learn these in detail in the upcoming lessons. I'm just again giving you that bird's eye view. Now let's change some properties of the button in the attribute section.
So, we can increase the width of the button and make the width of the button 300dp. I'm changing these features quickly. Don't worry you're going to learn all in detail. You don't have to pause or nothing. Let's just make the background color of the button red. Now to change the property of component you must make sure that you select the relevant component from the design area or component tree. We can change the text on the button, for example let's write 'Hello World'.
After changing any property you want, you can apply the change the component by pressing the 'Enter' key on the keyboard. Why don't we go ahead and change the size of the text 'Hello World'. All right, cool. So, I'm going to make the text style feature bold actually. And finally, determine the constraint values of our button. For this you can use the 'Infer Constraints' option here. All right. In our constraint layout lesson, we're going to go through all of the different parameters here. So, let's run the test application now. So, I'm pressing the 'Green Triangle' right here, just below the interface.
We can see that the application starts to run. Now the first time you run your project you might have to wait a bit to load. Might take some time to run it. So, as you can see our application open, we can also see the button we created in the design area from the virtual device. And of course, we haven't written any code yet. I simply showed you how to run a project on a virtual device. So, in the upcoming videos and in the next lessons we're going to write code along with the design.
So, right now, let's terminate the project we're running. And in order to terminate a project all you have to do is press the 'Red Square' icon here. Pressing this will stop your running project. So, just press the 'Green triangle' to run the project again. So, yeah in this lesson, we have now set up our virtual device and learned how to test our project on a virtual device. So, we're going to take a short break here and in the next lesson we'll continue to review Android Studio. All right. See you in the next one.
Mehmet graduated from the Electrical & Electronics Engineering Department of the Turkish Military Academy in 2014 and then worked in the Turkish Armed Forces for four years. Later, he decided to become an instructor to share what he knew about programming with his students. He’s currently an Android instructor, is married, and has a daughter.