Trying out ADK and the ‘Droid
With RIM’s market share drifting into the low 20’s and well because gadget’s are always fun, Android is looking pretty nice and I can easily “upgrade” my J2ME knowledge. I got myself a Samsung Nexus S1 to mess around with. I’m interested in playing with the bluetooth functions and with testing out OAuth and integrations with social networking tools – maybe my Fitbit for example.
Setting up Development
The first thing you’ll want to do is get a phone – I got mine from amazon.com. It is an unlocked Samsung Nexus S1 GT-I9020T phone. Be careful when ordering that you get the right model with the good screen –
there’s a very similar “cheap” version with a crummy screen. The screen is really the best feature with rich deep color, a slight curved surface, and a nice smooth feel. After installing a couple of the basics (Facebook and Angry Birds of course), things should be good to do. USB connectivity for mass storage works straight off with Windows 7 (64 ultimate) and Fedora 15. I’ll try a Mac at some point.
I have a couple of IDE options: Eclipse and IntelliJ. I use both of these tools for Java development, but I think for now I’m going to take the easy path and use Eclipse. If you’re going to develop for ‘droid you should sign up and pay the tax (I mean membership fee) although you don’t have to really (unlike the 4x tax for iPhone). developer.android.com is where to go for instructions. You’ll need to download the SDK manager, run the SDK manager, isntall all the stuff you want. If you are developing for the phone you’ll need a 2.3.x version of the SDK; 3.3.x for tablets. Be sure you install version 4 of the Google USB driver – forget all the crap on the internet about a Samsung USB driver and just use the Google one.
Once you have all that installed make sure you get Eclipse installed (I’ll be using both Helios and Indigo in 64-bit flavor with the latest 1.6 JDK. Follow the instructions on the developer site – they work. When you have the plugin installed make sure you go into the preferences and set the location of the Android SDK, during the install I set this to c:dev_toolsandroid, by default I think it was going into Program Files (x86).
Building a Test App
After a momentary panic that I had lost my bluetooth testing harness program (couldn’t’ remmeber the svn repo url), I’m back to quickly work thru this. Thankfully this is pretty simple. Pick New Project, find android and using the wizard fill out stuff. Make sure you pick off the right SDK for your device (phone == 2.3.x). Try out the sample apps – there are some pretty good ones. For some reason you need to give write access to
Eclipse to the samples directory – I went in and set the entire samples directory to not inherit permissions and then gave full access to “Everyone” – don’t necessarily advocate this as a secure thing to do…but it was easy. Once the app is built the next step is to set up a simulator environment and see if that works. On the Eclipse main menu go to Window and Android ASK and AVD Manager. Open that up and
select Virtual Devices and then New. You can add a bunch of different virtual devices to create so that you can test apps at different resolutions or on different hardware. The Nexus S1 phone has SDK 2.3.1 so I added a device with that SDK and another with 2.3.3 for kicks. When you’re done with all of that close out the menus and you are ready to run the app on a siumulator.
Right click on the project and pick “Run As…” from the menu and then Android Application. You’ll get a screen to pick off a device – click the Launch a Virtual Device radio button and then hit the Manager button. You’ll see that Manager screen again – pick one of the virtual devices you created and hit start. You should see
a simulator starting up.. You can close out the Manager now and in the device chooser screen hit the radio button for choose a running device and pick the emulator you just started. Hit ok and your app will be deployed to the simulator. How cool is that? Pretty easy stuff!
Deploying apps to a Real Phone
Simulator’s are cool and all , but what about a real phone? You should be able to connect your phone to the PC and grab meida files and such. Part of the ADK is a
USB driver for deploying and debugging apps. Make sure you have this driver installed in the ADK manager. It should be listed in the installed packages list – I installed rev 4. Click on it and note the path; see the pic to the left. Now take your device and go into Settings –> Applications –> Development and turn on debugging. Now attach it to the USB port on your PC. Windows of course will go into its regular “holy crap what is that thing” deal. Go into device manager, find the Samsung Adroid Device – it should have the “!!!! holy crap!!!” yellow icon on it. Double Click, select update driver, use the “from the place on my local PC” selection and browse to the directory path you saw in the Manager app for the USB driver. Click find and it should find your device ok.
Deploying the app to the phone is pretty much a repeat of the previous process except instead of selecting the virtual device, pick off your actual device. The app will be deployed to the phone straight away.
That’s pretty darn simple and on a par with iPhone and B-berry. The sample apps are quite a bit more sophisticated than those that come with either iPhone or B-Berry SDKs so it will be pretty fun to check through those. I didn’t see much “debugging” going on so I’ll have to try that out and post an update.
My next thing to try out will be to hook up my bluetooth testing program to the droid and see how good that API is – I hear it is quite simple to use. I scavenged my droid’s SIM from my iPhone and it seems like it has found a good home for a while. Now I also know what to do with that abomination of a language called Objective-C. 🙂
I should have pointed out that I’ve tried all of the above on both Eclipse Indigo and Helios both running th 64-bit mode. No issues with either.
Looks like this post lost all its images in the move from wordpress. Sorry about that.