Friday, February 19, 2010

My perfect Android development environment #2

Awhile ago I posted an entry detailing an Android development system based around Kubuntu 9.04. I used this for a while but later moved back to my usual Fedora set-up, based on Fedora 12. Whilst this worked well, I've since been wanting to get back to a KDE based system, but one with good security which Fedora has, but which Kubuntu seems to lack (firewall, and SELinux / Apparmor).

Anyway, I've now completed a working installation using OpenSuse 11.2 on my new Acer Aspire 5332 laptop which I'm very pleased with. I've also found that there are no good guides on-line on how to get Eclipse / Android SDK / OpenSUSE 11.2 to all work together, so if you (like me) have been struggling with this, read on!

Firstly, here's a screenshot of what we're striving for:



  • I used OpenSUSE 11.2 64 bit DVD for my installation. I assume these instructions also work fine for the 32 bit version. First step then, download the OpenSUSE 11.2 DVD from here: http://software.opensuse.org/112/en
  • I installed the system using mainly the default settings. Once complete, I got the laptop on-line and installed all updates, ready to begin the Eclipse / Android SDK installation.
  • Using Yast's Software Manager, I selected 'Patterns' from the 'View' drop-down, and then installed the following three patterns: Base Development; Linux Kernel Development; Java Development.
  • Next to install Eclipse. I found the version in Suse's repository to be problematic, so instead I download the latest version straight from the Eclipse Project web site. The following link is a useful reference to help you do this: http://developer.android.com/sdk/1.5_r3/installing.html
  • Firstly, download the 64 bit Linux version of Eclipse Classic 3.5.1 from here: http://www.eclipse.org/downloads/
  • Next, download the Android SDK from here: http://developer.android.com/sdk/index.html
  • Assuming the two files you just downloaded are in your Downloads folder, follow these steps in a terminal to unpack and install them:

cd ~/Downoad/
tar -xvf eclipse-SDK-3.5.1-linux-gtk-x86_64.tar.gz
tar -xvf android-sdk_r04-linux_86.tgz
su
mv eclipse /usr/local/bin
mv android-sdk-linux_86/ /usr/local/bin
chown -R root:root /usr/local/bin/eclipse        #Do not do this for the android-sdk-linux_86 directory, otherwise you won't be able to install the SDK later!


vi /usr/local/bin/eclipse/eclipse.sh

  • and make it look like this:

#!/bin/bash

export GDK_NATIVE_WINDOWS=1
/usr/local/bin/eclipse/eclipse

  • Save this, then make it executable:

chmod 755 /usr/local/bin/eclipse/eclipse.sh

  • Next, create a new Start Menu item for Eclipse by right-clicking on the Suse KDE Start Button and selecting 'Menu Editor'. Then add the following to the 'Integrated Environment' section of the start menu:

Name: Eclipse
Location: /usr/local/bin/eclipse/eclipse.sh
Description: Java IDE
Icon: /usr/local/bin/eclipse/icon.xpm

  • Start Eclipse, select the default workbench location.
  • Then select Help -> Check for updates.
  • Click 'Available Software sites'.
  • Next set-up the following software sources:

Android SDK 
https://dl-ssl.google.com/android/eclipse/

Galileo 
http://download.eclipse.org/releases/galileo/

The Eclipse Project Updates
http://download.eclipse.org/eclipse/updates/3.5/

  • Install all updates then restart Eclipse. Then
  • Help > Install new software....
  • Select the Location: 
  • https://dl-ssl.google.com/android/eclipse/
  • If you have trouble aqcuiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
  • Select the checkbox next to Developer Tools and click Install...
  • On the subsequent Install window, "Android DDMS" and "Android Development Tools"
  • should both be checked. Click Next. 
  • Read and accept the license agreement, then click Finish.
  • Restart Eclipse. 
  • Now modify your Eclipse preferences to point to the Android SDK directory:
  • Select Window > Preferences... to open the Preferences panel.
  • Select Android from the left panel.
  • For the SDK Location in the main panel, enter: /usr/local/bin/android-sdk-linux_86
  • Click Apply, then OK.
  • Disable useage stats.
  • Finally download the SDK packages using Window -> Android SDK and AVD manager.
Done! You should now be able to develop Android apps on your smart and secure new OpenSUSE 11.2 installation.

If you get stuck post a comment and I'll try to help. And if it works, post a comment and I'll just feel good!

Thanks for reading, Nick.