Sunday, December 23, 2007

My first steps with command-line development tools

As, I guess, most of the prospective Android developers, I started my Android experience by going through the Tutorial. This tutorial assumes Eclipse-based development environment. Many people love Eclipse but I am kind of old-fashioned and I prefer command line development tools. Somehow I feel myself more in control of what is happening during development. :-)

The documentation coming with Android is pretty exhaustive on command-line tools but I had to figure out myself how to use them because step-by-step tutorial similar to the Eclipse-based one is not available.

First, I created a root directory for the project then I created the project skeleton with the activityCreator script (I assume that the SDK was installed correctly so the SDK tool binaries are on the path).

C:\USERS\paller\android\helloworld>activityCreator aexp.helloworld.HelloWorld
This created the project skeleton into the current directory. The project skeleton is actually a functional HelloWorld application that can be compiled by invoking ant in the project root directory and may be executed on the emulator. Adb is the tool that talks to the emulator. In order for adb to function, the emulator needs to be running. Adb can be requested to query the available emulators.

C:\USERS\paller\android\helloworld\bin>adb devices
List of devices attached


If the emulator was started with the emulator command, the same adb command detects it.

C:\USERS\paller\android\helloworld\bin>adb devices
List of devices attached
1 emulator-tcp-5555 device 0


The ant script creates the installable package with apk extension in the bin subdirectory of the project root directory.

C:\USERS\paller\android\helloworld\bin>adb install HelloWorld.apk
151 KB/s (0 bytes in 2421.000s)


Now let's see the emulator. Our application can be found in the Applications folder that is the leftmost icon on the rolling bar.


Entering this folder, the application can be found and executed.


6 comments:

David said...

Hi, Gabor. How feasible is it to develop Android apps from the command line? I am thinking about doing it with a metaARPA membership from SDF.

Natalia said...

My first steps with UI tools

http://www.ceveni.com/2009/06/writing-android-hello-world-program.html

Gabor Paller said...

"Hi, Gabor. How feasible is it to develop Android apps from the command line?"

Well, I use them all the time. Others say it is the stone age. You have to decide yourself. :-)

I feel more in control with command-line tools.

Gabor Paller said...

Test

Gabor Paller said...

Another test

Richard Lalancette said...

I'd rather not to have to deal with command line.
I very rarely do and feel great about avoiding it :)

To each is own as long as we have fun, that's what matters :)

Richard L.
http://android9patch.blogspot.com/