Android Adventures - Getting Started With Android Studio 2
Written by Mike James   
Thursday, 07 July 2016
Article Index
Android Adventures - Getting Started With Android Studio 2
Your First Program
Project Structure
XML and Java

Google's Android Studio was recently released at Version 2.2 and there are big changes that make it even easier to create your first Android app. You can get started in a few minutes and by the end of this chapter, fully revised for 2.2,  have your first working Android application. 

There is a newer version of this chapter for Android Studio 2.3

Getting Started With Android Studio 2.3

 

androidJavaSmallAndroid Programming In Java:
Starting With an App
Third Edition

Is now available in paperback and ebook.

Available from Amazon.

 

 

  1. Getting Started With Android Studio 3
  2. The Activity And The UI
  3. Building The UI and a Calculator App
  4. Android Events
         Extract: Using Lambdas
  5. Basic Controls
  6. Layout Containers
  7. The ConstraintLayout
        Extract: Guidelines and Barriers
  8. UI Graphics A Deep Dive
        Extract: Programming the UI ***NEW
  9. Menus & The Action Bar
  10. Menus, Context & Popup
  11. Resources
  12. Beginning Bitmap Graphics
        Extract: Simple Animation
  13. Staying Alive! Lifecycle & State
  14. Spinners
  15. Pickers
  16. ListView And Adapters

If you are interested in creating custom template also see:

Custom Projects In Android Studio

Androidgears

 

 

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 create, and even distribute, your Android Apps. If you want to sell them using a well known marketplace there may something to pay - there is a one-time fee of $25 to register for Google Play - 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 book I will show you the fundamentals of Android programming. Not the tips and tricks, but how to think about what is going on. You'll be introduced to 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 produce 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 make the most of Android Studio will actually help you learn to code. 

Getting Started

This is a really good time to get started with Android because Google has released version 2.2 of 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. 

With the release of Android Studio Google has stopped work on the Eclipse add-in and this means that Android Studio really is the only way to develop apps from now on. 

I'm not going to spend a lot of time explaining how to install Android Studio in a step-by-step way - the Android website does a good job and it is more likely to be up-to-date. It is worth, however, going over the basic principles.  

First make sure you have the latest Java JDK installed, at least JDK 6.

If you don't have Java installed visit: Java Download. Once you have Java, setting up Android Studio is easy:

Download the Android Studio package from Android Studio Home page.

Install Android Studio which also installs all of the Android SDK and tools you will need.

Windows:

    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.

Linux:

 

    1. Unpack the downloaded ZIP 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 studio.sh. You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.

Accept any defaults that the setup program offers you - unless you have a good reason not to. It installs not only Android Studio, but the SDK and the virtual device system that lets you test your application. 

Note: Currently 2.2 is in preview and has to be manually installed. Download the compressed file and uncompress it to a folder of your choice. You will find the executable in the bin subfolder. 

 

setup

 

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.

Select:

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.

In most cases Android Studio just installs with no problem. 

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. 



Last Updated ( Monday, 27 March 2017 )