Installing Android SDK on Ubuntu PDF Print E-mail
Tuesday, 10 March 2009 14:04

Here's the steps I had to do to get the Android SDK installed & working on my Ubuntu laptop.  It started off as a stream-of-consciousness log of what I'd done, but has since been updated to fix mistakes I made so hopefully it still hangs together.  Broadly speaking this follows the steps in Installing the Android SDK, with the exception of pointing out the hiccups I encountered.

 

Installing the SDK:

  • Installed the Android SDK requirements as per System Requirements:
    • Downloaded Eclipse 3.4 Ganymede from here: Eclipse IDE for Java EE Developers
    • Unzipped to ~/wandroid/eclipse
    • Note:  I needed EE version because the Android editors wouldn't work as mentioned below.  Of course being new to Eclipse I hadn't downloaded this first time as the page listing the millions of available eclipse versions doesn't make it obvious which versions have WST, and my sensi di ragno weren't inspired.
  •  Installed Java 6
    • apt-get install sun-java6-bin (as per the Installation Notes which are at the end of the Installation page, below the section on "After Installation"............you know, right where you wouldn't expect them)
  • Edited my .bashrc to add the two tools to my $PATH
      export PATH=$PATH:/home/cianer/wandroid/android-sdk-linux_x86-1.1_r1/tools:/home/cianer/wandroid/eclipse
  • Then installed the Android Developer Plugin as per Installing the ADT Plugin for Eclipse
    • https wasn't working so had to use http, but hit a problem:
    • "Install has encountered a problem.  Error during provisioning.  Could not access keystore"
    • It would appear that Ubuntu installs some gcj version of java by default (I certainly didn't knowingly install it, and machine was a fresh install) and this version takes precedence.  Edited my path again
    • export PATH=/usr/lib/jvm/java-6-sun-1.6.0.07/bin/java:$PATH
    • but still got no banana.  Went back and re-downloaded the Ganymede version for Java EE developers because it contains full WST support whatever that may be.  This webpage Compare Eclipse Packages compares the various Eclipse versions, however don't use links on that page because they are old.  Use the link above instead.
    • Extensions then installed ok, but next step failed with 2 errors:
    • "Could not open selected VM debug port (8700). Make sure you do 
      not have another instance of DDMS or of the eclipse plugin running.
      If it's being used by something else, choose a new port number in
      the preferences. "
      " org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter
                 $TerminatingClassNotFoundException"
    • Teh innahwebs seems to think this a problem with the gcj shite, which on my machine was resident in /usr/bin/gij-4.2, so I uninstalled it completely. To remove it I had to first find out what application installed it
    • cianer@Feegle:~$ dpkg -S /usr/bin/gij-4.2
      gij-4.2
      cianer@Feegle:~$ apt-get remove gij-4.2
    • Now the active version of java (ultimately) points at /usr/lib/jvm/java-6-sun/jre/bin/java
    • cianer@Feegle:~/wandroid$ which -a java
      /usr/bin/java
      cianer@Feegle:~/wandroid$ ls -la /usr/bin/java
      lrwxrwxrwx 1 root root 22 2009-03-04 14:54 /usr/bin/java -> /etc/alternatives/java
      cianer@Feegle:~/wandroid$ ls -la /etc/alternatives/java
      lrwxrwxrwx 1 root root 36 2009-03-05 10:28 /etc/alternatives/java -> /usr/lib/jvm/java-6-sun/jre/bin/java
      cianer@Feegle:~/wandroid$
    • Now the second message is gone.  Error about port 8700 still appears occasionally but doesn't seem to cause issues.  Go figure.


Communicating with Phone:
  • Configured USB permissions for when G1 is plugged in, as per Setting up a Device for Development.  Note:  My version of Ubuntu is Hardy Heron, if a different version is being used the command is different.  Check link above for details.
      sudo vi /etc/udev/rules.d/50-android.rules
      Add the following (for Hardy); SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
      chmod a+rx /etc/udev/rules.d/50-android.rules
  • Plug in phone and call 'adb devices' from the command line (adb picked up by new $PATH in .bashrc):
       cianer@Feegle:~$ adb devices
      List of devices attached
      HT845GZ51012 device
      cianer@Feegle:~$

 

Building Hello World Application:

  • I built my HelloWurdled application as per instructions on the easy-to-read Installing Google Android SDK 1.0 On Ubuntu 8.04 Desktop but when I clicked "Run" the transfer failed and I got the following error:
      WARNING: Device API version (1.0) does not match SDK API version (1.1)
  • This is not an issue!  The SDK API is backwards compatible. 
  • After much hair-tearing I realised that the transfer was failing because I had the G1 plugged into a USB hub.  I have no idea if all hubs have this problem but bypassing the hub and connecting the G1 directly to the computer solved the problem.
 
Joomla Templates by Joomlashack