Setting Up Android Studio

Setting up the development environment - so that you can create Android applications - can take a quite a long time. However, it is similar to downloading and installing any piece of software, in that most of the time is just waiting.

Java

The first thing to do is to download the Java (which is the programming language used on the Android platform). You might think that you already have Java and be tempted to skip this step, but there are two main types: the type that nearly every one has that lets you run Java programs, and the type that most people do not have that lets you make Java programs. It's safer to follow this step unless you have written Java programs before and know that you have a JDK installed.

It can be confusing because there are so many different versions, but you should end up seeing something similar to that shown below:

screenshot taken from oracle website Choices for installing the Java Development Kit

Android Studio

Now it's time for Android Studio. This is classed as an Integrated Development Environment (IDE), which just means that it should include all the tools that you need wrapped up in an easy to use interface.

The first time that you run the software the Android Studio Setup Wizard will download any updates that it needs, which again can take a bit of time. Eventually though you'll see the startup screen that means everything is ready:

Android start up screen Android start up screen

Creating a New Project

Android Studio includes a number of templates that do most of the setup work for you. Most of the articles on this site will use the Empty Activity as a starting point - which is just the bare minimum needed to run an Android app.

When you have entered all of the details, the software will start to create your app.

Finding Your Way Around

The two important files will probably have been opened automatically (note, names can change depending on what you enter, but the file types are what is important):

If you accidentally close them, then you can find them in the Project area (left-hand edge of Android Studio), and open them by double-clicking.

Where to find the important files Where to find the important files: MainActivity (in the Java folder), and activity_main.xml (in the layout folder).

The first thing that you should do is check that everything is working OK; which you can do by running the app.

Where to find the 'play' button (green arrow) Where to find the 'play' button (green arrow)

After a few seconds the Device Chooser will open. Don't panic about the "Nothing to show" message - we haven't started any emulators yet (these are versions of Android devices that can run on your computer). An emulator should have been created during startup, and the option to launch the emulator should now have been selected.

It will take a while for the emulator to start, and the app to install, but eventually you should see Hello World! The emulator behaves just like a phone, so you can use the back button to exit the app.

A Note on the Visual Editor

It's possible that when you view the activity_main.xml file, you'll see a message about a rendering problem. This seems to just be a problem in Android Studio, and does not affect the app itself. To remove the erro, just switch the theme to something else.

Issue with rendering preview Issue with rendering preview