This little gem was found on the Webmater Talk Forums and I just had to share this.
In my recent post on How to Set-up your System to Run Android I covered the basic steps to get your system (MAC) up and running with the Android SDK. Now that you have Java, Eclipse and all the necessary files from Google installed, you’re now ready to start programming. The only problem remaining is you need an emulator, or Virtual Device, that can simulate an Android phone.
The good news, you have this already installed as part of setting up your system to run Android. All you need to do is configure the AVD.
Steps to get the AVD up and running:
- Start Eclipse
- Under the menu “Window” select “Android SDK and AVD Manager”
- When the window opens you will see “Virtual Devices” in the left pane
- Click on the “New…” button
Creating an Android Virtual Device: Settings
- In the “Name:” field, give the virtual device a name. I would recommend that you start with “Android” and then the target OS they you plan on using. If you are going to build for Android devices that are 2.1 and higher call it “Android-21”.
- For the “Target” pick one of the “Android x.x” APIs.
- For “SD Card” you can type in 512 Mib which is a safe and standard size.
- Under “Skin:” As a good practice you can go with HVGA as this is a standard 320 x 480 screen resolution for most android devices
What I like about the Android Virtual Device is you can create multiple virtual devices. This is why I recommend that you put the OS version in the name, such as “Android-15” (Version 1.5) or “Android-23” (Version 2.3). If you are going to be releasing your application out into the real world you’ll need to make sure it works on as MANY devices as possible otherwise you may get a bad review from an unhappy customer. I’ve have read that we, as programmers, should target Android devices all the way down to 1.5 and a lot of books out on the market say the same thing.
While I’m all for this, if you look at Google’s breakdown on Android OS market share, users are predominantly on 2.1 and up. This accounts for 97% of the market! Therefor I think that targeting versions 1.5 is a little drastic these days and it’s only going to get smaller and smaller as time goes on.
Now that you have a Virtual Device set up you can start programming and seeing what your application will look like. To run the AVD simply click on the green play button (for lack of better words) in the icon bar found in Eclipse.
What the Android Virtual Device Looks Like
So you’re ready to start building Android Applications. What do you need on your computer you ask? It’s not as complicated as you thing. Since I’m on a MAC, the instructions below focus on how to install Eclipse and the Androids SDK for the MAC OS. Windows isn’t too much different and although this will come across as biased, I actually believe that if you are going to be developing mobile applications, having a MAC is to your advantage because it would allow you to program for BOTH platforms, Apple’s iPhone and Google’s Android.
Mac & Window Users:
- You need Java installed and running on the Machine. (Mac’s come with this pre-installed.)
- A Graphical User Interface (GUI) called Eclipse. Free and easy to download
- The android SDK which is the most time consuming.
The whole process from start to finish will take about 1 hour. The real time kill is downloading the Android SDK and running updates. Downloading the complete framework takes about 30-40 minutes so watch some TV or play Angry Birds but this time, trying to get 3-stars on each level.
If You Need Java:
First, MAC’s already have this pre-installed but if you’re curious to see what version of Java you have, here’s how you do it. Launch your Terminal application. This can be found if you open your Hard Drive, go into your Applications folder and and then go into the Utilities folder. Inside the Utilities folder you will see the Terminal application.
Another quick way of getting there is under the Mac menu bar. Make sure you are not in any programs, meaning you need to be in your “Desktop/Finder View”. Your MAC’s nav should have a “Go” menu. Click on it and there will be a “Go to Folder”. When the screen asks what folder you want to open, enter “/Applications/Utilities”
Now you can drop in the follow line of text into the terminal window: java -version
You should get something similar to this:
If you have 1.6.0_(another number) this is fine. Basically you have Java and no need to worry. If you absolutely have to have the most recent version of Java, you can go here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
At the time of writing, JDK 7 has just come out. For Android development, you can install JAVA SE which stands for Java (Standard Edition) If you really want to go crazy you can go the rout of JAVA EE (Enterprise Edition) but that it just overkill at this point. Remember your building for a mobile app. The Enterprise Edition of Java is like buying a Mobile Home with everything in it! Including the kitchen sink. If you’re a hard core developer and you must have everything then enjoy, go for it. For the rest of us, stick with JAVA SE. You’ll have more than enough to figure out.
Getting and Installing Eclipse
You must have Java installed and on the machine before you install Eclipse. Eclipse has gone through some rapid updates itself due to Android becoming so popular. Here is a list of the last three releases, in order from oldest to newest:
- Old: Galileo (Version 3.5)
- Newer: Helios (Version 3.6)
- Current: Indigo (Version 3.7)
What’s nice about the download site http://www.eclipse.org/downloads/ is that it should automatically detect your machine and give you the proper list of files to download. When I first went here, it can be very confusing. There are a ton on version you can download but the one that works best and is recommend is Eclipse IDE for Java Developers.
Again you can go with the EE (Enterprise) version but it’s overkill. The regular version of Eclipse is filled with tons of options and I still don’t know what everything does, meaning, it is NOT short on functionality and features.
To determine if you need to download the 64-bit or 32 bit version . . . check your MAC’s system by going:
About This Mac -> More Info -> Software
64-bit Kernel and Extensions: No (Use 32-bit)
64-bit Kernel and Extensions: Yes (Use 64-bit)
Installing the Android SDK
Now for the final part of the installation. Getting the Android SDK and downloading all the goodies into Eclipse. The Android SDK is a collection of files and utilities that work together in the Eclipse IDE so you can create your Android Applications. Here is the location for the Android SDK: http://developer.android.com/sdk/index.html
Once you have the file downloaded you’ll need to unZip the file. This is where the fun starts. The extracted files will be in a folder called “android-sdk-windows” or “android-sdk-mac” depending on your OS. Since this will be accessed by Eclipse it’s up to YOU on where to keep the folder. Some people put it in the root of their hard drive while I’ve seen others put it inside their eclipse folders so it will all be “together”. While it doesn’t matter where you put it on your hard drive I seem to prefer that it is within your existing eclipse folder so you will know exactly where it is.
Now lets bring the two together (Eclipse with Android SDK).
Launch Eclipse. From the Eclipse menu go to Help -> Install New Software:
Click on the Add… button and then you will need to enter a Name and Location. The name can be anything you want but make it meaningful such as “Android Plugins”. For the Location field you can enter in:
From here you can Click OK. After a few moments you’ll see a list of Developer Tools which will be checked. Go ahead and click Next>. You will probably get asked to accept the terms of agreement so go ahead and click OK. Once the installation has gone thorough it’s steps, you will have to restart Eclipse.
Great! Now that Eclipse has been restarted let tell it where the Android SDK is. For MAC users it’s under Eclipse -> Preferences and then selecting “Android” in the Left column. Windows users should get the same thing under Windows -> Preferences
When you click the “browse” button, go to the folder where YOU saved the SDK. Do not use what I have in the screen shot. Once you click OK, you have just linked up Eclipse with the Android SDK.
Not so bad right? But wait, as will any technology, it gets old fast. It’s no different with the Adroid SDK and although you are jsut about done there is one FINAL highly recommended step. Updating the Android SDK which takes, well, a long time.
Updating the Android SDK
As a safety precaution, while in Eclipse, go under Help -> Check for Updates. This will ensure that you have the latest SDK update from Android which you just downloaded a little while ago. There should be no update here as you just downloaded and installed the SDK. It’s also a good reference to know where this is because unlike windows and MAC’s automated updates . . . you WILL NOT get notification and reminders about updating your SDK.
The second thing you need to do is go under “Window” -> Android SDK and AVD Manager from the Eclipse menu.
Once you are in the Android SDK and AVD you can look at your Installed packages. Below is a screen shot of everything that is in my system. You’re should have a lot less because you didn’t install the “Available Packages” yet.
Once you click on Available packages you should just simply select everything and click “Install” on the bottom. Like before, you will have to accept some user agreements so go ahead and Accept. Sit back, relax and now is the time to go do something else. This WILL TAKE TIME to download.
Basically, from here on, you have completed the installation of Android and Eclipse onto your system. You will most likely be asked to restart Android when the downloads are complete.
Some side notes:
You do not have to download some of the crazy packages that are there especially if you are not going to be developing for them. There are things like dual screen that I know I’ll never develop for but you get the idea. Quickly look over them and install as much as you can but not every single one is necessary. They will be there if you ever need in the future.
Next post will cover Setting up the Android Emulator.
As any new developer starting out in Android, the biggest challenge is learning all that the Android framework has to offer. Online references are usually a disaster when perusing through a Google search result. Sometimes, the examples never give you what you want or they leave out key parts of code that you need in order to understand what is being talked about. Better yet, some examples are so old and written just horribly that people don’t realize the good from the bad.
Considering I have banged my head a few times on the keyboard and let out an occasional profanity only to be followed by moments of happiness and joy at solving a problem (a few hours later), I’d like to bring some trials and tribulations to some of you who hopefully can find some help and answers in this blog post that I have started. Feedback and questions gladly accepted.
The title basically describes the events of today. It’s another wet, damp and rainy day. Uneventful with little to no excitement. The one thing to look forward to tonight are the Stanly Cup Playoffs between Boston and Tampa Bay. Since “Roli” the goalie is an ex-Islander, I’m rooting for Tampa as they have a good mix of young and veteran players that are totally focused and play as a team. Boston? I don’t like their style of play and at the end of game 1, when they were loosing 5-2 they turned into a bunch of goons. You aren’t going to get respect by literally punching 2 Tampa players in the face; even as the referees are looking right at you. Stupid. Tampa Bay is gonna laugh their way to a championship if Boston thinks that’s a winning way to play hockey.
Now it’s my turn to tell a tale. [For those of you who don’t know Star Trek, the titles of the posts are in someway related to the days events. With only 79 episodes, this will come to an end eventually]. So here I am, a typical New Yorker looking to get his morning breakfast to start the day. I walk into the corner Europa Cafe and decide on a toasted corn muffin w/ butter which I hadn’t had in years. I start to get a little reminiscent about my Healthology days as this was a popular breakfast treat that I ordered often from the PAX located across the street. Don’t misunderstand me, I’ve had muffins throughout the years but never a nice and toasty warm corn muffin. It’s rare to get this done right in New York as the places I’ve gone to hate to toast them. It either messes up their grill or creates a mess for the person preparing it as it crumbles apart when they butter it.So where is this all leading too, have patience I’m getting to it. So, on this rainy morning I dart into the Europa Cafe and set my sights on a corn muffin. As I’m waiting to place my order with the grill chef, one of the women from the cash register come over and ask if my order was taken, This strikes me as rather strange as the grill and cash registers are not close to each other. Regardless, I order a corn muffin and she replies, “You want it toasted with butter?” Amazing, she knows exactly what I wanted. This is great! Finally a place that is willing to heat up my muffins! It’s been ages.
Now as I approach the register with my muffin she rings me up and then hits me with something that totally catches me off guard. She says “I remember you. You are from my old store downtown.” My mind is trying to piece this together as fast as possible. Remember, it’s the morning, I’m on an empty stomach, it’s wet and miserable outside and I have a cashier telling me that they remember me. What is happening!? I’m not ready for this. What do I do? To be safe, I give the polite “Wow, that’s amazing you have a good memory.” She then gives me a reply “As soon as you came in I recognized you it’s been a long time. Here you are. Have good day.”
Dazed and confused I walk out of the store and try to piece together what just happened. I’m happy to say and it’s evident through this long blog post that I have finally figured it all out! While at Healthology from 2001-2005 I used to go to PAX and order my muffins. This is the same woman that used to work at that store and take my order over 6 years ago. To put this into perspective, there are literally millions of people in Manhattan and there are hundreds of people going in and out of a PAX store every day in minutes! Six years has passed and the cashier remembers me and the breakfast I order? I’m speechless and flabbergasted but obviously it’s worth writing about.Now for lunch. The name of the place is Blue 9 Burger. It may not look fancy from the outside but the burgers tasted great. Originally the guys at the office wanted to order from bearburger.com which serves ostrich burgers but due to them being over 20 blocks away from us and over 5 avenues, they didn’t want to deliveries to us. Thank goodness because the place we chose as out backup was probably just a good and a heck of a lot cheaper. For $7 you get two fresh, moist beef patties that actually had flavor. Real lettuce, tomatoes, onions and french fries that are extra crispy. This would blow away any McDonald’s or Burger King. The one thing that annoys we with BK and McD, is that what they SHOW you in all their pictures and menu-boards is NOT what you get. You see these beautiful delicious burgers in the photos but what you really get is mass produced, tasteless food the is crushed and looks nothing like their photos.
To describe what a Blue 9 burger looks and tastes like would be taking those BK and McD photos and actually putting the real thing on your plate to eat. Another thumbs up for today’s lunch. The mystery for what lies ahead tonight is diner as my wife is not home (and will not be for quiet a few days due to her trip to Norway) The problem is, I’ve become very dependent on her cooking diner for me so it’s going to be interesting the next few days. Wish me luck.