How to Set Up Your Computer for Android Development

Android is your friend!
Android is your friend!

I want to develop anroid applications on my computer, where do I begin?

Setting up your development environment for the first time can be quite a pain, but if you follow my guide you'll get it done quickly and easily! In this tutorial, we will:

  1. Install the Eclipse IDE for Android Development
  2. Download the Android SDK and Android Developer Tools
  3. Incorporate Android Functionality into Eclipse
  4. Create our First Android Application!

Beginning Android Application Development
Beginning Android Application Development

This was the first book I ever picked up, and it has proven invaluable in teaching me the basics of the Android platform, covering topics like the Activity Life Cycle, Widgets, Intents and much more!

 
Language of Android
Language of Android
Preferred IDE of Android
Preferred IDE of Android

Installing the Proper Software

Before we get started setting up our Development Environment, we need to download some software! Run through these steps:

  1. If you do not already have the Java SDK, go here and install it.
  2. You will also need the Java Runtime Environment (JRE), which is here.
  3. Okay, now you need an Integrated Development Environment (IDE). I recommend Eclipse, as it has official support for the Android plugins you will need. I use the Helios version of Eclipse, which is here, but any version should work. Do not download and install the Eclipse IDE until you have the Java SDK and JRE, as Eclipse is a java application itself and needs those to run.
  4. You will need the Android SDK to actually build Android Applications. Get that here. Install that preferably to the root of your hard drive (C://) in a folder called "Android" for simplicity. After the installation is done, run the SDK Manager and be sure to accept all of the packages for installation.
  5. You will also need the Android Development Tools (ADT), but we will get to that in a second.



Help   Install New Software
Help Install New Software
Downloading Android Developer Tools
Downloading Android Developer Tools
Window Preferences
Window Preferences
Your Screen Needs to look pretty similar to this one after you click "Apply"
Your Screen Needs to look pretty similar to this one after you click "Apply"

Setting up your Development Environment

Now that you have everything you need, go ahead and install Eclipse. After that is done, make sure Eclipse is installed and running correctly. It's time to add Android Functionality!

  1. Run Eclipse, click "Help" in the top toolbar and then "Install New Software", which opens a new window.
  2. In the text field, paste in "https://dl-ssl.google.com/android/eclipse/" and then hit enter
  3. A repository named Developer Tools will pop up, check its checkbox and then click "Next"
  4. A summary of what is to be installed will be displayed, click "Next" again. Make sure to accept all license agreements unless you plan on engaging in illegal activity. Click Finish and your software will be installed in the background! Woo Hoo!

However, we are not done just yet, you need to let Eclipse know where your Android SDK is located that you downloaded and installed just a bit ago.

  1. From Eclipse, Click "Window" and then "Preferences". A new window will pop up.
  2. Click "Android" on the left, you will see a text field called "SDK Location:"
  3. Click the "Browse" button and navigate to the folder where your SDK was installed and then click "Apply"
  4. A list of all the SDK Targets should pop up. Make sure you at least have Targets 1.5 through 2.3.3
  5. If everything looks good, click "OK" and you are ready to begin your first Android Project!

File New Android Project
File New Android Project
Hello World
Hello World
Hello World Properties
Hello World Properties

Creating Your First Android Project

Okay, I know that was a lot of work, but it is all going to pay off soon, I promise! Here we go!

  1. In Eclipse, click "File" > "New" > "Android Project".
  2. Give your project a name, for our example project, enter "Hello World". You will also need to specify a target; usually I just click whatever API my phone runs. I have an HTC Inspire, so I check the Android 2.2 checkbox.
  3. You will also need to have a package name. This basically sets up your folder hierarchy. The normal convention is to use your website backwards followed by the name of your app. For me that would be "com.technegames.helloworld"
  4. Specify 3 for the Min SDK Version. You will receive a warning telling you that the target and min do not match. This is a silly bug that Google has addressed but will most likely never fix, so don't let it bother you. Click Finish to create your project.

Alright, we have our project set up, let's make it do something!

HelloWorldActivity.java

package com.technegames.helloworld;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloWorldActivity extends Activity{
	TextView tv;
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		tv = new TextView(this);
		String text = getString(R.string.hello);
		tv.setText(text);
		setContentView(tv);
	}
}
Hello World output
Hello World output

Hello World

If you do not have an Android Emulator set up, here is a good guide on how to do that. If you would rather test your applications on your phone:

  1. If you do not have the Android USB device driver for your phone, you will need to find that (which isn't too hard).
  2. Make sure that USB Debugging is enabled on your phone by going to the settings screen of your phone and navigating to Applications > Development > USB Debugging.
  3. Plug in your phone to the computer using the USB cable it came with.


Once you have either A.) an emulator set up or B.) your phone configured correctly and hooked in, you are ready to start coding! Click on your HelloWorldActivity.java, and type in the code on the right, or download the source here!

Once you have the code in your project, run it! You should receive the ouput on the right >>>

Where to go from here

Well, now that you have a working Android Application, play around with it. I don't know about you, but I learn best by trial-and-error. See what works and what does not, and you will learn excellent programming practices!

At this point, I recommend you pick yourself up a book on Android Development. Now that you already have your development environment set up, you will be able to dive into these books and learn code quickly! The four books on the right are perfect for beginners wanting to learn how to develop Android Applications. Purchasing any one of these will set you on the right path!

I've finally gotten around to writing my first Android Tutorial, check it out here!

More by this Author


Comments 4 comments

sparkster profile image

sparkster 4 years ago from United Kingdom

I have tried this on many computers and just the setup ALWAYS fails. I really don't understand why they have make things so ridiculously and unnecessarily complicated, this is an awful lot of messing about which wastes months of your life before you've even learned any Java.

To be honest I find all this messing about a complete waste of time and it has put me off ever attempting to become an Android developer. Apple won this war a long time ago.


Alucard_1990 profile image

Alucard_1990 4 years ago from Nashville, TN Author

@sparkster,

I am very sorry that you feel that way, because Android development is such a rewarding experience. I also develop for iOS, and I will agree with you that setting up a developer environment for that is much easier; however, with both environments configured properly, I am most often developing in Android.

If you ever change your mind, or want a detailed walk-through, let me know.


sparkster profile image

sparkster 4 years ago from United Kingdom

I have managed to successfully develop a few Android apps, but I did that by staying well away from Eclipse, JVM, Android SDK, etc.

Despite all the messing about I did trying to set up a PC as a development environment I ended up just downloading AIDE on my tablet and that was all I had to do! I wouldn't say it's rewarding though.

I really don't understand why the companies have to make things so complicated when they really don't need to be. Then you've got Admob & Adsense - both of them say you have to use the other one! Then there's the Admob SDK to make things even more complicated again. Quite pathetic in my opinion.


pn-mayaa 3 years ago

Nice post! Thanks for your clear explanation.. I found this http://androidtechstuffs.blogspot.in/2012/12/confi... also useful. Have a look, might help you..

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working