Android 101: System Setup
Join the DZone community and get the full member experience.
Join For FreeIn the previous article in this series, we looked at the basic concepts of the Android architecture. In this article, we'll look at how to get Android setup on your system. I'll make the assumption that you already have Java 5+ installed. To make life easier for yourself, you should also have Eclipse installed as your development IDE.
Setting Up The Android SDK
- Download the Android SDK from http://d.android.com/sdk/index.html.
- Once downloaded, extract the zip file to a location on your hard drive. Optionally, you can add the location of the SDK to your system PATH.
- Run the SDK setup program. On Windows, this will be SDK Manager.exe while on other platforms you will need to run tools/android. This program will allow you to install SDK components such as documentation, platforms, add-on libraries and USB drivers.
- Typically you will want to select everything here so that you can write applications for any Android target.
Development Tools
The next part of your setup is to install the Android Development Toolkit in your Eclipse instance. The best way to do this is to use the Update Manager under the Help/Install New Software menu. Just add a new update site pointing to https://dl-ssl.google.com/android/eclipse.
Once the install completes you'll need to restart Eclipse.
Your First Android Project
Now you're ready to really get into Android development.
First you'll have to let Eclipse know where to find the Android SDK. Go to the preferences dialog, and click on the Android item to do this:
Your one last step is to ensure you have an AVD (Android Virtual Device) from which to run your application. You can do this from the AVD manager:
When you use the New Project wizard, you'll have the option to create an Android project:
From here you can create a project that has a particular Android SDK targetted:
If you click on next, you will also be able to create an Android test project that will allow you to test out your app.
Inside the project you will see the source for your newly created activity:
package com.dzone.android.app;
import android.app.Activity;
import android.os.Bundle;
public class FirstActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
We'll change this around a little, creating our own view to use:
package com.dzone.android.app;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class FirstActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView view = new TextView(this);
view.setText("A New App");
setContentView(view);
}
}
To see if this works, click on Run As / Android application. This will launch the Android emulator and start up your newly created application
Now that you've got your system properly set up, the next few articles in this series will bring you through the process of writing your own application.
Opinions expressed by DZone contributors are their own.
Trending
-
Chaining API Requests With API Gateway
-
Building a Flask Web Application With Docker: A Step-by-Step Guide
-
What Is React? A Complete Guide
-
Introduction To Git
Comments