Setting Up Your Environment
Getting Android running on Eclipse is easy, but the documentation was pretty dispersed. Here is a quick start based on my experience on Vista.
Download Eclipse. I’m using eclipse-jee-ganymede-SR1-win32, I already had the J2EE version installed, I imagine you could use any the regular Java version.
Install the ADT plugin, the directions on the Android site are fine. You should also download the Android SDK. I am using android-sdk-windows-1.1_r1, so check the current version to see if anything has changed.
There are a few interesting things in the SDK:
These are the command line tools that you won’t be needed TOO much. Most of the things you can do in the command line are better performed in the DDMS perspective in Eclipse (more on that shortly!)
One thing that I’ve already needed the command line for is creating an sdcard. You’ll need one if you want to use the camera or record any media on the emulator. The beginning of this tutorial on Camera Capture describes the the process pretty well. All I had to do was add an sdcard into the spot where Android stores it’s user data on Vista, like this:
C:\…\android-sdk-windows-1.1_r1\tools> mksdcard 1024M C:\Users\<USER_NAME>\AppData\Local\Android\SDK-1.1\sdcard.img
Full of useful code that will get you started. Personally I thought the NotePad application was a great starter app (if visually boring), using a couple activities linked together and SQLite. If you just want open one of these apps, use the steps under Creating an Android Project in the Eclipse with ADT setup guide.
Let’s Start Coding!
Well, you have everything you need, lets jump in and see how it works. The Hello World Tutorial on the Android site is fine. Go ahead and follow the steps to create a new Android application. It will auto-create some code for you. Jump down to the section Run the Code: Hello Android and you’ll setup the run configuration. Once you have the emulator running, go ahead and look through the remaining tutorial, it will teach you a little bit about coding in Android. Stop at Debugging Your Project though, and lets look at some useful tools.
DDMS (Davlik Debug Monitor Service)
This is a good time to dig into the a tool that will really enable you to develop to the emulator. It runs as a perspective within Eclipse, so lets open it now, and switch to that perspective.
I don’t want to get too bogged down in the details of this screen. The most important detail for you right now is the LogCat. This is where you can view all the errors you would be coding if you were me.
LogCat isn’t too complication. You can set the debug level – (V) is Verbose, (D) is debug – here, or under Windows -> Preferences -> Android -> DDMS *NOTE – You can also see the ADB Debugger Port in that menu, we’ll be using that shortly.
One further note on LogCat. A couple times the logging seemed to stop when I started using LogCat, especially if ADB.exe process stopped, or I had to restart the Emulator. When this happened, I found selecting my application under the Devices tab seemed to work. Give it a try if your logging stops.
Alright, last topic. I’m pushing the limits of “quick start” already!
If you’ve been a software developer sometime in the last decade, you expect to be able to step through your code. You can with Android, but the setup is a little different from other Eclipse projects… Here is a good Eclipse setup guide that has an excellent section describing Debugging the emulator with Eclipse.
My only issue was the port my debugger was sitting on was different, so make sure to check Windows -> Preferences -> Android -> DDMS and check the ADB Debugger Port.
I believe you need to set breakpoints, before launching the app. If you have a breakpoint set like this:
When your application hits that code, Eclipse will automatically prompt you to switch to the Debug perspective. Let it switch, and you will be able to step through your code.
You should have enough to begin work in Eclipse. Good Luck!
Leave a comment
- iOS Unit Testing With OCMock
- Why Stakeholders Need To Be Involved In Scrum
- NuGet Config File Transformation Causes Duplicate Entries On Update
- Load Testing with Locust on Windows
- Writing A Custom LINQ Provider With Re-linq
- AutoMapper Profile Organization
- Rails 3.2: A Nested-Form Demo Part 4: Switch to Targeting Computer!
- SharpRepository: Configuration
- Rails 3.2: A Nested-Form Demo, Part 3: We’re Starting Our Attack Run!
- Rails 3.2: A Nested-Form Demo, Part 2: Accelerate to Attack Speed!
- Rails 3.2: A Nested-Form Demo, Part 1: All Wings Report In!
- iOS Behind the Curve
- Distributed Transaction Coordinators, Port 135, and Firewalls – Oh My!
- SharpRepository: Getting Started
- Find Performance Problems Using JMeter, MySQL and Xdebug/Webgrind
- Taming Hot Key Context Shifting When Running A Windows VM In Virtualbox On OSX
- Integrating Twitter’s Bootstrap Into Your Project
- Mobile payments, tags and more using NFC
- Stress Pig
- Dear Client Services, What Works?
- What Would Steve Do?
- Still Using Fiddler to Test & Debug Your REST Services?
- Write-through and Generational Caching Make a Great Team
- Thinking Recursively
- Development Incentives, What’s the Payoff?
- How do you like them Apples?
- “Optional” Software Development Practices Series — Code Review
- Adding Images to Select Lists in MVC3
- “Optional” Software Development Practices Series
- You Get What You Pay For…
- Outsourcing Safety Tips
- Facebook IPO
- The Ballad of Tim Toady
- The Little Schemer
- Newsflash: Mom leaves tech job at 5p.m.
- I <negative_emotion> Windows 8!
- Prefix vs. Postfix Increment and Decrement Operators in C++
- Corporate videos: viral boon or epic fail?
- Recruitin’ Time!
- Reference vs. pointer parameters in C++
- The IE8 "hover" Bug: The Most Awesome IE Bug Ever?
- When is perfect perfect enough?
- SOPA/PIPA: Anti-Censorship Protest or Techies Revenge?
- A Decade of Fairway
- Handling Session Timeout Gracefully
- Generating Software Diagrams
- The Audacity of Nope
- The Origins of Culture
- Scrum Overview in Prezi – not another boring slideshow
- Numbers don’t lie: LinkedIn Statistics
- What is your favorite software development tool?
- Best Practices for Selecting Onshore, Nearshore or Offshore Information Technology Outsourcing (ITO) Providers
- Sign of the Times
- Advantages and Risks of Offshoring, Nearshoring or Onshoring
- Does Outsourcing Mean Offshoring?
- Too little, too late?
- New Favorite Lunch Spot
- Why should I care about functions as first-class citizens?
- PHP Remote Debugging with XDebug and NetBeans
- Installing SubText with Web PI
- ROI Primer
- Learn Domain-Driven Design
- Learn Behavior-Driven Development
- Mario Kart Tournament
- F# in 90 Seconds
- Website Vulnerabilities
- Scrum Overview
- Language Club
- Top 12 Favorite Podcasts Ever…
- Fairway Dart Tournament
- Learn Lean Software Development and Kanban Systems
- Android – Eclipse Quick Start
- Learn Functional Programming
- Backup & Restore Strategy
- Smartphone Screens – Another Wireless Variable
- Wireless Application Market
- Head First AOP