Android Adventures - Getting Started With Android Studio
Written by Mike James   
Tuesday, 21 January 2014
Article Index
Android Adventures - Getting Started With Android Studio
Project Structure
From Code to Emulator
Running the App

Google's Android Studio makes creating native Android apps very easy. You can get started in a few minutes and by the end of this article have your first working Android application. This ongoing series on programming Android, now up to part seven has been updated to the latest version of Android Studio.

Android Adventures With Android Studio


  1. Getting Started With Android Studio
  2. The Activity And The UI
  3. Building The UI and a Calculator App
  4. Lifecycle and State
  5. Basic Controls And Events
  6. Spinners
  7. Pickers
  8. UI Graphics A Deep Dive
  9. ListView And Adapters
  10. Introducing Fragments
  11. Fragments and XML
  12. Fragment And Activity Working Together
  13. Managing Fragments
  14. Custom dialogs using DialogFragment
  15. Dialog Classes In DialogFragment
  16. A NumberPicker DialogFragment Project
  17. ViewPager

If you are interested in creating custom template also see:

Custom Projects In Android Studio





Android represents a big potential market. It is also the most open of the "big" phone platforms. All the tools you need to create an Android App are free. You don;t need to pay anything to join a club to create and even distribute your Android App. If you want to sell using a well known marketplace such as Google Play or Amazon then there is usually a small annual fee, but you don't have to use any particular distribution method.

All that stands between you and your Android app is your imagination and programming ability. I can't do much to improve your imagination but I can help with the programming side of things. In this ebook I will show you the fundamentals of Android programming. Not the tips and tricks, but how to think about what is going on - that is the general principles that will make it possible for you to master anything that you encounter that is new in the future. 

What do you need to know to get started?

You need to be able to program in a modern object-oriented language. Java would be best as it is the language used to create Android apps but C#, C++, VB or anything similar are close enough in spirit to Java for you to be able to cope. You might well need to look things up about the specifics of particular features of Java but most of the time it should be obvious or obvious with the help of a few comments. 

It isn't necessary to be an expert programmer because for a lot of Android programming you are simply using the features and facilities provided - that is a lot of Android programming is just a matter of following the rules. However if you hope to create something unique and useful you will at some point have to add something of your own - and here creativity and skill are required. So you might not need to be an expert programmer to get started but you need to become one by the time you create your amazing app.

Fortunately practice is a good teacher and so learning to code for Android will actually help you learn to code. 

Getting Started

This is a really good time to get started with Android because Google have released Android Studio which is an easy to use Android IDE - Integrated Development Environment. Before this you had to use the Eclipse IDE and setup the SDK and other pieces of software needed. This wasn't difficult but Android Studio makes it easy and it makes programming Android easy. Put simply it is the way of the future and so worth your investment in learning it. 

At the moment there is one simple drawback to using Android Studio - it is only available as a Developer Preview. This means that there are parts of it that are unfinished and there might well be bugs.

However in practice it works well and it is based on well tested code. In other words it isn't too early to get started using it. As Android Studio changes the chapters of this ebook will be updated, but there is still a possibility of a slight discrepancy between description and the way the IDE works.

So to get started. First make sure you have the latest Java JDK installed. If you don't have Java installed visit:

Once you have Java setting up Android Studio is easy:

  1. Download the Android Studio package from Android Studio Home page.
  2. Install Android Studio which also intalls all of the Android SDK and tools you will need:


    1. Launch the downloaded EXE file, android-studio-bundle-<version>.exe.
    2. Follow the setup wizard to install Android Studio.

    Mac OS X:

    1. Open the downloaded DMG file, android-studio-bundle-<version>.dmg.
    2. Drag and drop Android Studio into the Applications folder.


    1. Unpack the downloaded Tar file, android-studio-bundle-<version>.tgz, into an appropriate location for your applications.
    2. To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute

      You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.

On some Windows systems, the launcher script does not find where Java is installed and you will find that you can't run the newly installed Android Studio. It appears to start and then just vanishes.

If you encounter this problem, you need to set an environment variable indicating the correct location of the Java JDK.


Start menu > Computer > System Properties >
                       Advanced System Properties.

Then open

Advanced tab > Environment Variables,
                      add new system variable

and setup JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21.

There is a second problem that stops some installations working. As well as JAVA_HOME being set to the jdk directory you also need a PATH set to the bin directory. Use the same method of setting the environment variables but select the existing path variable and use the Edit button to add a path to the jdk bin directory, for example ;C:\Program Files\Java\jdk1.7.0_21\bin.   Note, you have to use a semicolon separator between each of the directory paths specified as part of the PATH variable. 

Now you should be able to run Android Studio. If not the most likely cause of the problem is the JDK and so re-installation is a best first option.


Your First program


One of the earlier versions of Android Studio provided a template for a Blank Activity that always added a Fragment to the user interface. This made things more complicated so we provided a custom template that didn't use a fragment. This is no longer necessary as long as you are using hte latest Android Studio.  

The custom template is still available in the CodeBin and if you want to know more about how the template works see:Custom Projects In Android Studio. But, to be 100% clear, you no longer need it.


When it finally gets going you will see the Welcome screen:




If you have already created some programs you might well see them listed in Recent projects. Assuming this is your first project select the New project option. 



You can ignore the details of the new project for the moment. All you have to do is supply a name for your application - HelloWorld in this case.  

By default the app will run on anything from Android 2.1 up and will be stored in your personal directory under AndroidStudio. You an also supply a package name which is used to identify the app - in theory forever. It is usual to use a domain name you own in reverse order so as to avoid naming clashes but notice that not all characters allowed in a URL are allowed in a Java package name. For example the "-" in i-programmer is illegal. 


Last Updated ( Thursday, 20 November 2014 )

Copyright © 2015 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.