Android Development Tools Installation on MAC

Env: MAC OS X 10.6.6

1. Download and install Android SDK

http://dl.google.com/android/android-sdk_r09-mac_x86.zip


2. Install ADT Plugin for Eclipse

- URL : https://dl-ssl.google.com/android/eclipse/
- Archive zip: http://dl.google.com/android/ADT_9.0.0.zip

3. Lauch Android SDK and AVD Manager

- Go to /android-sdk-mac_x86/tools and double click android
- Eclipse: Window/Android SDK and AVD Manager

Click Available Packages at left panel and select the one need to install

4. Create an Android Virtual Device (AVD)

<zt>: http://developer.android.com/resources/tutorials/hello-world.html

- Eclipse:  Window > Android SDK and AVD Manager
Select Virtual Devices in the left panel.

The Create New AVD dialog appears.

Type the name of the AVD, such as "my_avd".
Choose a target. The target is the platform (that is, the version of the Android SDK, such as 2.1) you want to run on the emulator.
You can ignore the rest of the fields for now.

Click Create AVD.

5. Create a test app as the normal way in Eclipse



<zt>  http://developer.android.com/resources/tutorials/hello-world.html

Here is a description of each field:
Project Name
This is the Eclipse Project name — the name of the directory that will contain the project files.
Application Name
This is the human-readable title for your application — the name that will appear on the Android device.
Package Name
This is the package namespace (following the same rules as for packages in the Java programming language) that you want all your source code to reside under. This also sets the package name under which the stub Activity will be generated.
Your package name must be unique across all packages installed on the Android system; for this reason, it's important to use a standard domain-style package for your applications. The example above uses the "com.example" namespace, which is a namespace reserved for example documentation — when you develop your own applications, you should use a namespace that's appropriate to your organization or entity.
Create Activity
This is the name for the class stub that will be generated by the plugin. This will be a subclass of Android's Activity class. An Activity is simply a class that can run and do work. It can create a UI if it chooses, but it doesn't need to. As the checkbox suggests, this is optional, but an Activity is almost always used as the basis for an application.
Min SDK Version
This value specifies the minimum API Level required by your application. For more information, see Android API Levels.
Other fields: The checkbox for "Use default location" allows you to change the location on disk where the project's files will be generated and stored. "Build Target" is the platform target that your application will be compiled against (this should be selected automatically, based on your Min SDK Version).


6. Construct UI on HelloAndroid.java and modify 2 line to run it as Android Project

package com.example.helloandroid;

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

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TextView tv = new TextView(this);
       tv.setText("Hello, Android");
       setContentView(tv);
   }
}


猜你喜欢

转载自mcecho.iteye.com/blog/909068