views:

5651

answers:

11
+30  Q: 

Android Development

I am interested in trying some Android Development and I've not had much luck getting started. I'm not much of a Linux person but I have an Ubuntu box setup that I attempted to install the android SDK and plugins for Eclipse. But I'm not having much luck getting it setup.

I'm looking for some guidance for what would be the best way for me to do this.

  • Should I use a different Linux distro?
  • Is eclipse the wrong way to go?
  • I was hoping this was a way for me to get some Linux exposure too, so I don't even know if there is a way to accomplish this in Windows, but I'm sure someone else would be interested to know that info.

I have looked at the instructions at Google, but everything I read assumes a prior knowledge of Linux, Eclipse or both. There also doesn't seem to be many troubleshooting helps.

+10  A: 

You might find this book, Hello Android, helpful. It includes information on getting started, installing the tools and so on. I've not read it, myself, but the company behind it is pretty solid.

Tim Sullivan
I read the book and it does a great job getting you started, but that's about it. It got me up and running pretty quickly, but I outgrew it w/in a week.
fiXedd
This book's out of print. :-/
joshjs
...BUT. It's on Amazon: http://www.amazon.com/Hello-Android-Introducing-Development-Platform/dp/1934356174
joshjs
There's a second edition, linked to from the original link in the post. It's http://www.pragprog.com/titles/eband2/hello-android; I'll update the answer to include this second edition link.
Tim Sullivan
Second edition is now out of print, third edition available: http://pragprog.com/titles/eband3/hello-android
Kleist
+4  A: 

@bpapa

It's a perfectly valid question. The number one reason was that The Iphone SDK wasn't out when I started looking at it. But I don't have a particular App in mind.

  1. I'm more likely to own an Android phone in the future since I'm not an AT&T customer (I live in the boonies so there is no 3G support)
  2. It will support more types of phones such as normal handset types, touchscreens and full blown PDA's.
  3. It's open source.
Haydar
You might also include the fact that you don't have to pay money for an SDK or purchase a mac to do android development.
Anthony Potts
Man, if you don't have 3G... well browsing on EDGE is just painful. Consider that when purchasing.
jcollum
+2  A: 

You shouldn't give up. It's very important that you learn to be comfortable in linux/unix. Ubuntu is the way to go for distro. What language is the SDK written in? Break things into sizable chunks. You are trying to tackle too many unknowns at once it seems. Spend some time just learning ubuntu, then eclipse, then unix, then try to delve into the SDK.

CodingWithoutComments
+55  A: 

I haven't done any Android development in Linux, so my answer is based on my Windows experience, so to answer your first question last, yes. It can be done in Windows.

From what I've read / heard the following should be applicable to Linux as well.

Eclipse is definitely where you want to be building your Android applications from. Google have released a plugin (Android Developer Toolkit) that automagically integrates all the debugging tools, emulator, compiler, new project wizard, etc. You don't need it, but it makes everything much easier.

Both Eclipse and the SDK are download-unzip-run installations that should be straight forward to get running. If you haven't already, start by getting the latest Android SDK from [http://code.google.com/android/download.html'], just unzip it into a new development sandbox and take note of where you put it.

Getting Eclipse Setup

You can download a compatible Eclipse with all the libraries and tools you need for Android from here: [http://www.eclipse.org/downloads/packages/']

The 'Eclipse IDE for Java Developers' package has everything you'll need. To install just unzip it into a new folder and run the Eclipse.exe executable, let it create a new workspace wherever you like. Once you're in you'll want to install the Android plugin to make your life easier.

Select Help > Install New Software..., and in the dialog box the comes up enter https://dl-ssl.google.com/android/eclipse/. into the 'work with' text entry box.

Hit OK and accept all the prompts until it's installed. Restart Eclipse and you're almost ready to rock.

Select Window > Preferences... and select Android, then put the folder where you unzipped the SDK into the SDK Location text box. Hit Apply then OK and you're done.

Getting Started

The Plugin creates a new Android project type in the New > Project... menu. Every new project is actually an implementation of 'Hello World' that can help get you started.

Before you can use the emulator you need to create a virtual device. An Android virtual device lets you specify a target Android platform, screen resolution, and hardware settings.

To create a Virtual Device select Window > Android SDK and AVD Manager. Click the 'New' button and select a name and target platform. In most cases you'll want to select the latest API Level with the Google APIs (Eg. Google APIs (Google Inc.) - API Level 4). Enter an SD Card size greater than 8M and select a skin / screen resolution depending on the device you wish to emulate. Select the 'Create AVD' button.

To run it up in the emulator hit the Run > Open Debug Window... menu option. The defaults should work just fine, so hit Debug and the default AVD should launch and show your new application.

Reto Meier
+1 But...Does this need a bit of updating? Is Europa still the recommended package?
Dog Ears
Good point. Updated.
Reto Meier
Would be great to see other IDE support. Thanks
Perhentian
fantastic response.
Paperino
Really helpful.. Thanx..
neha
+2  A: 

Make sure you are starting with the right version of Eclipse. The 0.9 beta version of the Android SDK requires Eclipse 3.3 or 3.4. If you are using Ubuntu's Gutsy release, the Eclipse provided through the Synaptic package manager is version 3.2.X. If you use that you will have problems even creating an android project.

JasonAnderson
A: 

Once installed, I found Dan Morrill's video on getting started to be helpful.

Curtis Inderwiesche
+2  A: 
  1. Start with a development box, and a development environment, you are comfortable with - if that means Linux then well and good, but if in reality you are more comfortable with Windows, then use Windows. You do not want to necessarily be spending more time sorting out how to get your video adapter configured just right, when in fact you want to develop Android applications. The Android Development Kit is Java based and there is nothing about Android or Android development that says that you must Linux. You can use Windows, Linux, and Mac OS - as long as you can run Java.

  2. This brings me to my second suggestion - use a good Java IDE. Especially if you are not yet familiar with Java. Most people use Eclipse, and that is what Google seems to recommend. Use the latest version of the one called Eclipse for Java Developers. However, If you are already familiar with Java and you prefer another IDE, then use that. Again, you do not want to be spending time finding your way around a new tool set when you really want to be learning a new API.

  3. Obtain the latest Android SDK.

  4. If you are using Eclipse, get the Android Plugin.

  5. Start developing. Develop, test (in the emulator), redevelop, show to your friends, re-redevelop. Repeat

  6. If you can get one, get a real Android device - the T-Mobile G1 (otherwise called the HTC Dream) has just been released.

  7. ???

  8. Profit

Vihung
A: 

I think bpapa has a point. Why not just write a Web application?

You'll have a far bigger audience if you do so. I.e: Iphone, any computer with a Web browser...

hendry
+1  A: 

Everything you need to know is right here: Google dev site

Google seems to cater heavily to Eclipse users as far as their tutorials are concerned, so I would recommend it. Why use Linux if you are unfamiliar with it? Use whichever OS you're used to since Java will theoretically run on anything.

+8  A: 

I just went through this myself (on kubuntu 8.10), here's the gotchas I came across:

  1. I got the sun java 6 for my development.

    sudo apt-get install sun-java6-jdk

  2. I made it my default java as well

    sudo update-java-alternatives -s java-6-sun

  3. Get eclipse 3.4. eclipse 3.2 is the latest in the repository (as of this writing).

    wget http://download.eclipse.org/technology/epp/downloads/release/ganymede/R/eclipse-java-ganymede-linux-gtk.tar.gz
    tar xzvf eclipse-java-ganymede-linux-gtk.tar.gz
    mv eclipse eclipse3.4

  4. Make the sun java 6 jre the eclipse default by editing the eclipse file and moving /usr/lib/jvm/java-6-sun to the top of the list.

    sudo emacs /etc/eclipse/java_home

  5. Download the zip file for linux from google

  6. Here's what nailed me the first time around: permissions. Here's what you got to do:

    sudo unzip android-sdk-linux_x86-1.1_r1.zip -d ~/libs/
    where "~/libs" is wherever you are putting the sdk.

  7. Fix permissions on two files:

    sudo chmod a+r ~/libs/android-sdk-linux_x86-1.1_r1/tools/lib/images//userdata.img
    sudo chmod a+r ~/libs/android-sdk-linux_x86-1.1_r1/tools/lib/images//system.img
    Thank Diego Torres Milano for that one.

  8. Open up your ~/.bashrc file and add the following to your PATH:

    ANDROID=andriod-sdk-linux_x86-1.1_r1; export ANDROID
    PATH=$PATH:~/libs/${ANDROID}/tools:.; export PATH
    I added an ANDROID variable too, as you can see simply for ease of versioning. That's the only place it's used and it's optional.

  9. Fire up eclipse by running

    eclipse3.4/eclipse
    and follow the install directions from google for getting the plugin.

All of that got me to "Hello Android". The biggest thing was the permissions so I hope that helps. Really it was the stuff I found on Diego's site, and some other sites on getting eclipse 3.4. Thanks, internets.

I've made this a wiki so if I missed anything or could be clearer please update.

Good luck!

caseyboardman
Just did this on a fresh install of kubuntu 9.04 (jaunty). The eclipse stuff was the same, but the android I downloaded and unzipped as me (not root) and I just ran the HelloAndroid by following the google directions.
caseyboardman
A: 

As you can develop in a Windows box too, I would suggest you go with Windows if you feel more comfortable. Eclipse is the perfect tool for developing Android apps. The documentation in this link is self-sufficient to get started. If you choose Linux that should not make any difference. I have both Windows Vista and Fedora 9 in my laptop and I run Android code in both of them using Eclipse.

russoue