ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software

How to Set Up Your Computer for Android Development

Updated on January 9, 2012
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!

Comments

    0 of 8192 characters used
    Post Comment

    • profile image

      pn-mayaa 5 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..

    • sparkster profile image

      Sparkster Publishing 5 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.

    • Alucard_1990 profile image
      Author

      Stephen Gowen 5 years ago from Nashville, TN

      @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 Publishing 5 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.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: "https://hubpages.com/privacy-policy#gdpr"

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)