Wednesday, May 27, 2009

android notes - the process of development

0 installation and setup
1 create a project

$ android create project --target 1 --path ./demo --activity demo --package com.example.demo

2 edit source code ~/myspace/demo/src/example/demo/demo.java
3 compile with ant

$ ant -debug -verbose

4 run emulator with a script

#! /bin/sh
out/host/linux-x86/bin/emulator -verbose \
-kernel prebuild/android-arm/kernel/kernel-qemu \
-ramdisk out/target/product/generic/ramdisk.img \
-system out/target/product/generic/system.img \
-init-data out/target/product/generic/userdata.img \
-avd myavd -sdcard ./sdcard.img -no-skin -no-boot-anim

5 install the application we have build

$ cd ~/myspace/demo
$ adb install bin/demo-debug.apk
$ adb install -r bin/demo-debug.apk (for reinstall)
$ adb shell
# logcat
# ps a (to get process id to kill)
# kill -9



That's on java side, on the android side,
1 setup

$ cd ~/myspace/mydroid
$ source ./build/envsetup.sh
$ lunch 1

2 build the project in android

$ cd ./frames/base/media/libmediaplayerservice
$ mm (it builds libmediaplayerservice library as an example)
$ cd ~/myspace/mydroid (go back to the root)
$ make snod (build the system image

then you can go back to run emulator with parameters specified in the script.