In this project we will use the Android Studio new project wizard to build an app we can actually run on a real Android device. It won’t do anything except print some text to the screen but it will demonstrate the first step that all our Android game projects will require.
This is made really easy for us because Android Studio will auto-generate a basic screen layout as well as the Java code to bring it to life. In this mini-project, we will go no further than that but in subsequent Android projects we will practice the skills that will eventually build into a full working game.
First of all, run Android Studio.
Then click Start a new Android Studio Project from the top of the list of options as shown below.
In the Configure your new project dialog box enter Blank Game Project as the application name and if you have a website you can enter your company/personal domain name. If you don’t have a domain name you can enter what you like here this only really matters when you come to publish a game. If you are unsure just enter gamecodeschool.com as shown in the image. You can leave the Project Location field at the default. This is the location where all the files for your project will be saved. It is worth making a note of this if you are embarking on a more significant project than this but for now, it doesn’t really matter.
On the Target Android Devices screen, we can configure which versions of Android and which types of device to target with our game. Make sure the Phones and Tablets checkbox has a tick in it. It probably has by default.
For the Minimum SDK to target option, a good rule of thumb is to pick a newer version of Android that does not exclude too many older devices. At the time of writing Ice Cream Sandwich is a good choice. But it doesn’t matter too much while we are learning. If you are unsure just leave it at the default that Android Studio selects.
Now click Next.
The next option we have is to Add an Activity to mobile. We can think of these options as starting templates. There is no template for “Cool Game” so select Empty Activity and then click Next.
The next screen is Customize the Activity. Activities are a key part of all Android apps and games. We can think of them as containers for our games. That is, all our games run inside of an Activity. So what exactly is an Activity? An Activity is made up with code written by the Android development team in the form of a class. We don’t need to understand any more than that for now and we will gradually build our understanding of classes, the Activity class and how we can use them to our advantage as the projects and tutorials progress.
For now, all we need to do is name our Activity. In the Activity Name field type BlankGame (with no spaces). Notice that all the other field is automatically updated for us.
Perhaps surprisingly, we have an app that we can actually deploy to a real Android device or run on the emulator that we installed in the previous tutorial. In the next project, we will actually deploy our game to an Android device this will show you exactly how to do that. Why not have a look around at the files and folders that Android Studio has created for us. Don’t worry too much about what everything does because in the upcoming mini-projects which are designed to increase our understanding of the Java tutorials we will see what we need to do to make things happen.