• $10 Game Dev' Courses - Use code "BREAKTHRU"

    Video courses

Unity Pro Development A to Z – Build 10 Android/iOS Games

The Complete Android & Java Developer Course – Build 21 Apps

The Complete Java Developer Course. Learn Step by Step

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.

  • Learning java by building Android games

    Learning Java by Building Android Games

    Want to learn Java for Android? Even if you are completely new to either Java, Android, or game programming but are aiming to publish Android games, then this book is for you. This book also acts as a refresher for those who already have experience in Java on other platforms or other object-oriented languages.
    • Setup your own Android game programming environment using Android Studio
    • Control logic, branch your code, and add real decision-making depth to your games
    • Design and use 2d sprite animations, smooth pixel graphics, sound FX, simple collision detection and artificial intelligence (AI)
    • Build around a dozen sample test apps and 4 complete working games!
    Amazon USA
    Amazon UK
    Amazon CA
    Our Store (US only)
    small_book

    Android Game Programming by Example

    Learn to build exciting Android game projects. Build a simple flappy-bird like game to a multi-environment, tough, retro platformer then an OpenGL ES 2 Asteroids clone, running at hundreds of frames per second .
    • Animate your characters with sprite sheets, add multiple scrolling parallax backgrounds, and implement genuinely tough, playable levels in your games
    • Every single line of code is printed in the book! No need to refer to the code files while trying to follow along. All the code files are also supplied separately so you can refer to them in their completed form and copy/paste them into your project if you like.
    • Implement a multitude of other game features such as pickups, firing weapons, HUD’s, generating and playing sound FX, scenery, level transition, high scores, and more
    Amazon USA
    Amazon UK
    Amazon CA
    Our Store (US Only)

About this project

Skill level 1
Time to complete 10 minutes

New concepts

  • Creating a new Activity
  • Targeting the latest Android devices
  • Building an empty Android project using the Android Studio new project wizard

Recommended preparation tutorials

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.

android-studio-2_2_2-start-screen

Then click Start a new Android Studio Project from the top of the list of options as shown below.

Tip: If any of the images in this or any of the projects/tutorials on this site are too small you can click on them to enlarge them.

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.

android-studio-2_2_2-create-new-project-screen

Click Next.

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.

android-studio-2_2_2-target-android-devices-screen

 

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.

android-studio-2_2_2-add-activity-to-mobile-screen

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.

android-studio-2_2_2-customize-the-activity-screen

Click Finish.

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.

Please visit the Android category of our game coding bookstore for beginners