2010/12/27

android eclipse setup for ubuntu 10.10 64bit

寫過一篇android build on ubuntu 10.10,其實早就寫好關於 android app 的部份,只是並非寫在這兒,底下就貼一下。

* URL: http://developer.android.com/sdk/index.html
* Quick Start
  o Prepare your development computer
  o Download and install the SDK starter package
  o Install the ADT Plugin for Eclipse
  o Add Android platforms and other components to your SDK

Install Android SDK, Java, Eclipse

  * Host Environment: Ubuntu 10.04
  * Eclipse: sudo apt-get install eclipse eclipse-jdt
  * Start Eclipse:
    o 應用程式 ==> 軟體開發 ==> eclipse

Install ADT with Eclipse v3.5(Galileo)

  * URL: http://developer.android.com/sdk/eclipse-adt.html
  * Start Eclipse, then select Help > Install New Software.
  * In the Available Software dialog, click Add....
  * In the "Name" field: Android Plugin
  * In the "Location" field:
     https://dl-ssl.google.com/android/eclipse/
  * Click OK.
  * In the Available Software view:
    o Check the Developer Tools
      + Make sure check Android DDMS and Android Development Tools.
    o Click Next.
  * Click Next to read and accept the license agreement and install any dependencies, then click Finish.
  * Restart Eclipse.

Configuring the ADT Plugin

  * Select Window > Preferences
  * Select Android from the left panel.
  * SDK Location ==> click Browse ==> locate your downloaded SDK directory, such as "/home/wade/src/android/android-sdk-linux_86"
  * Click Apply, then OK.

Adding Android Platforms and Other...

  * URL: http://developer.android.com/sdk/adding-components.html
  * Windows --> Android SDK & AVD Manager

Install a Platform

  * In the Android SDK and AVD Manager, choose Available Packages in the left panel.
  * Click the repository site checkbox to display the components available for installation.
  * Select at least one platform to install, and click Install Selected. If you aren't sure which platform to install, use the latest version.

Create an AVD(做一次就好)

  * In Eclipse, choose Window > Android SDK and AVD Manager.
  * Select Virtual Devices in the left panel.
  * Click New.
     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.

Create a New Android Project

  * From Eclipse, select File > New > Project.
  * Select "Android" -> "Android Project" and click Next.
  * Fill in the project details with the following values:
    o Project name: HelloAndroid
    o Application name: Hello, Android
    o Package name: com.example.helloandroid (or your own private namespace)
    o Create Activity: HelloAndroid
    o Click Finish.

Construct the UI

Run the Application

  The Eclipse plugin makes it easy to run your applications:
  * Select Run > Run.
  * Select "Android Application".
    o Select Target Device
    o Project > Properties > Run/Debug Settings > Edit > Target > ....
  * For the first time to run android app, it will show "Select a way to run ...".
     Please select "Android Application"

Start Emulator(有兩個方法)

# Eclipse
  * By Project-->Run to start emulator with installation app
  * Window --> Android SDK and AVD Manager --> Virtual Devices, and then....
Select a device --> Start

# Command Line
  * $ export DISPLAY=:0.0
  $ emulator -system system.img -data userdata.img -ramdisk ramdisk.img

0 意見: