fredag 18. mai 2012

A quick android-sdk install guide for ubuntu (12.04)



Download Oracle Java
 http://www.oracle.com/technetwork/java/javase/downloads

We will extract javaXX.tar.gz into /usr/local/java, so lets create that first.
$ sudo mkdir -p /usr/local/java

Then extract it
$ sudo tar -xzvf  javaXX.tar.gz -C /usr/local/java

Then we add a path to java into either /etc/profile, or your local .bashrc file.

# JAVA PATH
JAVA_HOME=/usr/local/java/jdk1.7.0_04
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
JAVA_HOME=/usr/local/java/jre1.7.0_04
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
# END JAVA PATH

Then we will give the location to where java is
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.7.0_04/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_04/bin/javac" 1


Download and install android SDK
http://developer.android.com/sdk/index.html

Download and install Eclipse => helios (3.6). If you have no clue, Eclipse classic is pretty sexy i guess... 
http://www.eclipse.org/downloads/


Add a path to both android-sdk and eclipse inside .bashrc
$ echo "export PATH=${PATH}:~/.android-sdk/tools:~/.android-sdk/platform-tools:~/.eclipse" >> ~/.bashrc

Open eclipse, add new "repository" to install the ADT plugin
https://dl-ssl.google.com/android/eclipse/

I am obviously using ubuntu, so in order to connect to the phone using adb i had to
create a new udev rule.. ("99-android.rules"-filename might differ on ubuntu versions).

$ sudo nano -w /etc/udev/rules.d/99-android.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="XXXX", ATTRS{idProduct}=="XXXX", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="XXXX", ATTRS{idProduct}=="XXXX"
TEST=="/var/run/ConsoleKit/database", \
RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}"


$ sudo chmod a+rx /etc/udev/rules.d/99-android.rules

If you wonder what your vendor and product id is, simply use the tool lsusb
$ lsusb 
(OUTPUT blah blah blah)
 Bus 001 Device 005: ID XXX1:XXX2 MOBILE PHONE-THINGY

Where XXX1 is Vendor ID, and XXX2 is Product ID.

----------------------------

Then you should be ready to start develop apps.

This is a pretty nice series of tutorials found on youtube:
http://www.youtube.com/watch?v=CxPh1tgiK2g&feature=relmfu

wich starts with how to install the environment and goes on from there.


Ingen kommentarer:

Legg inn en kommentar