First Use of Android! Hello android.

来源:互联网 发布:iphone数据流量打不开 编辑:程序博客网 时间:2024/05/17 02:12

Here is a simple flow to install, create project, run project..

1. Download the Android

http://developer.android.com/sdk/1.5_r1/index.html

 

Choose the right one with the specified OS.

 

2. Install the Android.

Just unpack the zip to a specified folder.

 

3. Set the tools to system path

If you want to use command of android directly, you can set the %Android%/tools to the system path.

 

4. Create project without eclipse plugin

Just use the following command to create a project named "HelloAndroid"

android create project --package com.android.helloandroid --activity HelloAndroid --target 2 --path c:/test/HelloAndroid

It's easy to understand the params. if you have any question, please visit the development center.

 

5. Build a certain version of android app

Use the following command to buid a debug version

ant debug

Use the following command to build a release version

ant release

 

6. Check the targets

Use the following command to view all the targets(devices).

android list targets

 

7. Create an avd

Use the following command to create an avd(Android Virtual Device ), and choose a target.

android create avd --name my_avd --target 2

 

8. Run your emulator, remember to specified your avd name.

emulator -avd my_avd

 

9. Install your app to emulator

adb install %Project_Path%/HelloAndroid-debug.apk

 

Alternately, you also can use

ant install

to instead of step 5 and step 9

 

then you will see the icon in your android phone!!!!

Android