In my last blog, we look at the features of the RIoTBoard and started setting up our devbox so we could get ready to write Android apps. In this post, we're going to finish setting up Eclipse. We'll install Android version 4.3 from the SDK Manager and add the Devices panel to our environment. In the next installment, we will finish getting our devbox ready for writing Android apps, add the Devices panel to Eclipse, and connect our RIoTBoard to devbox. In the final installment, we'll write our Hello, world app and transfer it over to the RIoTBoard for testing.
I. A Quick Look at Eclipse
Hopefully, you were able to start Eclipse by the end of the last blog. After you get past the splash screen, it will ask you where you want to save your app files. I chose to create a new directory in my "Documents" folder, but you can place it anywhere you prefer on your computer. Check the box so it won't ask you to do this again.
After it finishes loading, Eclipse will ask you if you would like help building your app. We're going to build our app a different way, so x-out of this window:
You should now be looking at the Eclipse workspace:
Lots of white space. Don't worry-- we're going to start filling this up with code just as soon as we tell Eclipse what version of Android we want to use. To do this, we need to run a program called the SDK Manager. It was installed to your computer as part of the Android Developer Tools (ADT), and, if you're curious, you can find it in the main ADT directory:
Getting to the SDK Manager is so important when building Android apps, that the version of Eclipse you downloaded as part of the ADT includes a nifty button which will launch it so you don't have to go hunting through directories to find it:
Let's click it and launch the SDK Manager.
II. Using the SDK Manager
The RIoTBoard comes equipped with Android 4.3, also known as Jelly Bean. This means we will need to tell Eclipse that this is the version of Android we're going to use to build our apps. You do that in the SDK Manager. (And don't worry-- just because we're developing our app for version 4.3 doesn't mean it won't run on earlier versions of Android. I'll show you how we address the issue of backwards compatibility a bit later.)
When you start the SDK Manager up, it will automatically connect to Google's servers to locate all the latest updates to Android versions and tools.
Give it a few minutes to find all the updates out there.
Available files in the SDK update window fall into three categories: Tools, Android versions (APIs), and Extras:
Even though API 19 (KitKat) is the latest version, we're going to stick to API 18, since that corresponds to the Android version on the RIoTBoard. The only thing we need to select is SDK Platform for API 18. Select that and click Install 1 package:
(By the way, here's what we aren't going to download: emulators. And this is a beautiful thing. Why do I inveigh so often against Android emulators? Because they are memory-hogs. They tend to reduce your machine to a standstill if you can get them working at all. In my Android class, most of the complaints centered around slow-running emulators for Intel and ARM. Here's a taste. Now, back to the installation.)
You may need to consent to a legal agreement when it pops up:
After it finishes, re-start Eclipse.
III. Finish Configuring Eclipse
Once Eclipse opens up, we need to add a panel to see any Android devices which might be connected to devbox (hint: it's going to be the RIoTBoard. ) To add the Devices panel, click on the top Windows toolbar, then select Show View, and Other...:
Next, select Android from the pop-up box:
And select Devices:
Voila! You should now see a new panel for Android devices in the main Eclipse window:
Time to connect our RIoTBoard. You'll need a mini-USB to USB-A cable. It's easy to confuse mini-USB with the now-dominant micro-USB. Make sure you get the right one:
The other end of the cable is a regular USB-A connector:
On the RIoTBoard, there are two different mini-USB ports. One of these is not yet activated. Plug your USB cable into port J11-- the one right next to the Ethernet port:
Now connect the other end to devbox. It should automatically install the RIoTBoard driver. Once you get the message that the driver has finished installing, you may be surprised to see that it still doesn't appear in the Devices panel in Eclipse:
The reason is that we need to enable Debugging mode on our RIoTBoard-- just like you would on any other Android device connected to devbox. Go into the RIoTBoard's Settings and click on Developer options:
Check the box for USB Debugging:
You'll get a pop-up warning; click OK (We know what we're doing, right..?)
Now restart Eclipse and check in the Devices panel:
Now, "0123456789ABCDEF" may not be the most intuitive default name, but rest assured-- this is the RIoTBoard!
If you've made it this far, you're doing a great job. You've finished setting up ADT and Eclipse, downloaded all the software you needed from the Android SDK Manager, and got devbox to recognize your RIoTBoard.
Next time, we'll write our app and transfer it over to the RIoTBoard for testing.