Creating a new project and an emulator on Android Studio — Android Tutorials 2

Hello again! In previous post, we learned how to setup our environment to develop using Android Studio. Today, we’ll create a Hello World project and run it in an Android emulator.

Once Android Studio opens, select the Start a new Android Studio project option. The wizard that appears will help us to create a new project without much effort. In the first screen, let’s input some basic data, as the application name (using Hello World here) and the Company Domain, that works like an unique identifier for our app. You can use a domain that you owns, or concat your Github username (like rafaeltoledo.github.io). I’ll use rafaeltoledo.net for this example. For this project, we will not select C++ support. Maybe in a future and more advanced tutorial :)

In the next screen, let’s configure which modules we’ll include in the project, and the supported Android versions. Today (January 2017), my personal recommendation is to target API 16 as Minimum SDK. This way, we will make our app compatible with more than 97% of active Android Devices. You can obtain more info about the currently active Android versions here, with monthly updates.

At this time, we will select only the Phone and Tablet option.

In the next screen, select the Basic Activity option. The wizard will generate a lot of stuff, but don’t worry. We’ll understand each of the elements soon! So, by now, just click Next.

Lastly, let’s keep the Activity name as MainActivity, and keep the other options with the default values as well. Then, click Finish.

Wait a bit until the dependencies is being resolved and the project is initialized.

To execute the project, we’ll create an emulator, also known as AVD (Android Virtual Device). Click the AVD Manager button on toolbar.

In the windows that will pop-up, click on Create Virtual Device… button, that will prompt another wizard.

In the next screen, we have a list of tablet and cell phones, that will serve as a base for our emulator. Choose any one that you want. For this example, I’ll pick Nexus 5. Click Next.

Continuing with the wizard, now we need to choose which version of Android our emulator will run. My recommendation is to use a recent version and, if your machine processor and OS supports 64 bits, choose the x86_64 option with Google APIs. For this tutorial, I’m selecting the 7.1.1 version. If the image wasn’t downloaded yet, click Download before proceeding.

In the latest screen, we can customize some device settings, like camera, memory and so. By now, just keep the defaults and click Finish.

Close the AVD Manager screen and click Run button on Android Studio’s toolbar.

After waiting a bit, the emulator will be executed and your app will be compiled and deployed to it. And… success! :)

Well, now we have a functional environment for our next ‘hands-on’ posts! Stay with us, follow me here on Medium to receive the next posts of this series.

See ya!