Pages

Sunday 9 December 2012

My First Android App

Yesterday, I decided to keep up with the rest of the world in some ways, so I bought a Samsung Galaxy ACE smartphone. I know, it is not a really high-end stuff, according to the current state of the smartphone market. Anyhow, I think it is a great value for 85 pounds, with a pay as you go contract. I am really impressed by this phone, and I decided, to develop a hello world application. So, I first downloaded the Android SDK. As I extracted the tar.gz, the Readme file told me how to carry on with the installation. So I followed the instructions, first with the UI:
tools/android update sdk
With the UI, I selected to install:
  • Android SDK Tools
  • Android SDK Platform-tools
  • For Android 2.3.3
    • SDK Platform
    • Samples for SDK
After the process finished, the log window had a warning:
Stopping ADB server failed (code -1).
I will ignore it for now. The whole stuff is consuming around 307 megs at the moment.
cd tools
./android list targets
And I created a project:
./android create project --target "android-10" --name HelloWorldApp \
--path ~/Documents/android/workspace/HelloWorldApp \
--activity MainActivity --package eu.lakat.example.helloworldapp
Let's go back to the "root":
cd ..
I created a small script, to include all the paths in one shot:
export PATH=$PATH:"$(pwd)/android-sdk-linux/tools/":"$(pwd)/android-sdk-linux/platform-tools/"
Changed the directory to the applications:
cd workspace/HelloWorldApp/
Compiled it to debug:
ant debug
And installed it on my device:
adb install bin/HelloWorldApp-debug.apk
Everything worked perfectly fine, I found the app in my device, and was able to run that easily. Cool!

Virtual device

android avd
Use th UI to create a new device, and simply execute:
adb install bin/HelloWorldApp-debug.apk

1 comment: