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-1.6.0.24;”
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

Encase anyone else is also having issues with eclipse or STS crashing or randomly closing on ubuntu? try running the latest official Sun JDK (instead of openJDK) is in Ubuntu 10.10 Maverick Official Partner Repository Thanks to the guys at webup8 for how to enable. There’s also a good stackoverflow question here.

The error i was getting…

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb53d1635, pid=3933, tid=1804258160
#
# JRE version: 6.0_20-b20
# Java VM: OpenJDK Server VM (19.0-b09 mixed mode linux-x86 )
# Derivative: IcedTea6 1.9.7
# Distribution: Ubuntu 10.10, package 6b20-1.9.7-0ubuntu1
# Problematic frame:
# J  com.android.dx.rop.code.Rops.ropFor(ILcom/android/dx/rop/type/TypeBearer;Lcom/android/dx/rop/type/TypeList;Lcom/android/dx/rop/cst/Constant;)Lcom/android/dx/rop/code/Rop;
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
#   https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
#

## A fatal error has been detected by the Java Runtime Environment:##  SIGSEGV (0xb) at pc=0xb53d1635, pid=3933, tid=1804258160## JRE version: 6.0_20-b20# Java VM: OpenJDK Server VM (19.0-b09 mixed mode linux-x86 )# Derivative: IcedTea6 1.9.7# Distribution: Ubuntu 10.10, package 6b20-1.9.7-0ubuntu1# Problematic frame:# J  com.android.dx.rop.code.Rops.ropFor(ILcom/android/dx/rop/type/TypeBearer;Lcom/android/dx/rop/type/TypeList;Lcom/android/dx/rop/cst/Constant;)Lcom/android/dx/rop/code/Rop;## If you would like to submit a bug report, please include# instructions how to reproduce the bug and visit:#   https://bugs.launchpad.net/ubuntu/+source/openjdk-6/#