These are a couple of command line commands I have never managed to commit to memory so I figured I’d blog them for reference.

Install apk on multiple connected devices
$ adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X install pathto/myapp-release.apk

Port forwarding device
adb forward tcp:8000 tcp:8000

Generate an Ant build.xml
$ android update project -p .

Developing  Android on Ubuntu? here’s how to define your JAVA HOME and PATH:

What you’ll need:

  • Path to your Java installation
  • Path to your Android SDK installation
  • admin password

On windows you’d edit your environment variables, on linux you edit the .bashrc file.

Run this command:
sudo gedit $HOME/.bashrc

prompted for admin password.

Add the following lines to your .bashrc. Please ensure where you installed the Java libraries and your android sdk. The below reflects default installation directories.

export JAVA_HOME=”/usr/lib/jvm/java-6-sun-;”
export PATH=$PATH:$JAVA_HOME/bin
export PATH=$PATH:$HOME”/android-sdk-linux_86/platform-tools”

Save file.

Run this command to reload your .bashrc:
source ~/.bashrc

Test by typing adb version
You should get something like
Android Debug Bridge version 1.0.26