« Click here to read part 1, introduction to Kin.

This is part II of the Kin Android development tutorial. In this part, I will explain how to set up a new Android project, compile the source code and view it in a virtual device. This will set up everything you need to start building and seeing the fruits of your work on a virtual phone.

First of all, you have to download and install Android Studio, this is the IDE (integrated development environment) where you can edit code, create virtual Android devices (more on that later) and compile the code to deploy on the Play store. You can download Android Studio here: https://developer.android.com/studio.

Creating your first project

After you have installed Android Studio, open the program and create a new project. You will be presented with a few screens.

Choose project screen

The first screen asks you to choose a project type. We are going to start super bare bones, so select “empty activity”. This means we will get a little bit of started code that will show something, but nothing more.

Project configuration screen

The next screen is used to name your project and set the minimum API level. You can name your application whatever you want. The package name is typically com.companyname.applicationname, it helps to use a naming scheme like this.

The tutorial will be in Java, so select Java as the language. The minimum API level needs to be 26, as that is also the minimum required by the Kin SDK. Click next again, the project will be created and you will be greeted by a screen that has a lot of options. It will look something like this:

Android Studio SDK main screen

On the left you have a file explorer. This is basically a list of files and folders that make up your Android project. On the right is the code editor. Here we will write all code that we need to integrate the Kin SDK and create some sweet earns and spends. Lastly, the bottom shows some build status. The IDE has many, many more screens and options which I’m not going into right now. We will explore them as we need them.

Creating a virtual Android device

It’s important to be able to quickly see what your code is doing. For this, we are going to create a virtual Android device. This is an Android phone that runs on your computer. Open the AVD Manager (Android Virtual Device Manager), under the tools menu:

AVD Manager menu

A screen will open with the option to create a new virtual device at the bottom. For this tutorial I created a virtual Nexus 5X:

Create new virtual device screen

In the next screen you have to select an Android version. I suggest version 28 (remember the minimum is 26, so don’t select a version lower than that). It probably needs to download some stuff, then you can finish creating the virtual device. You will be sent back to the AVD screen, but now with a virtual device on it:

AVD screen of virtual device

Now click the green button and the phone will start! You should see the welcome screen of Android pop up.

Running the project on the virtual device

The last step of this tutorial part is to run your new project on the virtual device. This is really simple, just press the “run” button on the top right:

Run app button

It will build the project and then run on your device. When you see a screen pop up with “Hello World!” on it, congratulations! You have just set up the Android Studio, created a simple project and ran it on a virtual Android device.

If it is not working, it’s probably one of two things:

The emulator needs to be enabled in the simulator. Go to the Android Studio settings and open the Appearance & Behaviour — System Settings — Android SDK menu. Then enable the Android Emulator, it’s here (note the SDK tools tab):

Enable the Android Emulator if it is not turned on

Press OK, download everything and finish up. Then try again.

If the app still doesn’t start and you also don’t get an error, it probably just didn’t auto-start the app but it is on the device. In the emulator, open the app manually. Click on the square box on the lower right, swipe up the container and select your app. You should see the app pop up saying “Hello World!”

In part 3, we will start actual programming by integrating the Kin SDK.