Android Development Without Eclipse

Following up on my “First Steps” article, I did some more Processing development on Android. I ran into some problems, solved some, and was able to start my ported Processing program inside the emulator.

This article is still not about actual Processing source code. All I did was fiddle with the Android SDK tools some more.

Building Without Eclipse

Eclipse is kind of a resource hog (yeah, I know, “I told you so” just ain’t saying it). Therefore, I took a closer look at the command line tools from the Android SDK to replace it (at least part of the time).

To convert an existing Eclipse Android project to an Ant project that you can build from the command line, use the “android” tool from the SDK:

android update project --target <android-target> --path <path-to-project>

You can see a list of possible values for the <android-target> parameter with the command “android list targets”:


android list targets
Available Android targets:
id: 5 or "android-8"
     Name: Android 2.2
     Type: Platform
     API level: 8
     Revision: 2
     Skins: HVGA (default), QVGA, WQVGA432, WQVGA400, WVGA854, WVGA800

When you run the “android update project” command, it will update and/or create the required files. In the case of an existing Eclipse Android project, it will create the file “build.xml” (the Ant equivalent of a Makefile).

Once the “build.xml” file exists, you can build the project from the command line using the command:

ant debug

If the emulator is running, you can build and install the program in a single command:

ant install

Debugging Without Eclipse

To debug without Eclipse, you can use “jdb” on the command line (kind of like “gdb” for Java).

First, you want to set up the application inside the emulator so that it waits for a debugger to attach (in case you need to debug the initialization code). Start the “Dev Tools” app inside the emulator, go to “Development Settings”, select your application as the “Debug App”, and check “Wait for debugger”.

Then start the Dalvik Debug Monitor (“ddms” tool in the Android SDK). This will allow jdb to connect to running apps inside the emulator or on a connected device.

Dalvik Debug Monitor

Run your app inside the emulator. When you start it, a message will inform you that it’s waiting for a debugger to attach.

Waiting For Debugger

Start jdb with this command:

jdb -sourcepath <path-to-project-sources> -attach localhost:8700

(The port number 8700 is shown in the Dalvik Debug Monitor.)

Eclipse remote debugging settings

Instead of using jdb directly on the command line, you can use any IDE that supports remote debugging of Java applications. You can even use the regular Java plug-in inside Eclipse and create a debug configuration for a “Remote Java Application”. (Although, if you’re using Eclipse, you can use the Android plug-in anyway.)

See also Gregory Grubbs’s site for more tips on Android development without Eclipse.

Increasing the App Partition Size

For the program that I am porting, I have around 25 MB of graphics and sounds. I will look into either reducing the size or storing them on the SD card. For now, they are in the “assets” directory of the project and are copied into the .apk file.

Installing the .apk on the emulator failed because of insufficient space:

     [echo] Installing HelloAndroid-debug.apk onto default emulator or device...
     [exec] 617 KB/s (25809226 bytes in 40.813s)
     [exec] 	pkg: /data/local/tmp/HelloAndroid-debug.apk

To increase the size available to apps, the emulator must be started with the “-partition-size” parameter. This command reserves 100 MB for apps:

emulator -partition-size 100 -avd <virtual-device-name>

The “-partition-size” parameter can also be specified in the field “Additional Emulator Command Line Options” of an Eclipse debug configuration.

With all this, I got my program running inside the emulator. It is painfully slow, which I hope is due to limitations of the emulator and not of Processing. The .apk is too large to install it directly on my device, so I’ll have to reduce its size before I can try it there. More on that later…


6 thoughts on “Android Development Without Eclipse”

  1. You also can develop on your android device with DroidDevelop and JavaIDEDroid.
    As result you will have apk file.
    All programs avails on the android market.

Leave a Reply

Your email address will not be published. Required fields are marked *