Three tips to help alleviate the frustrations of Android Development in Eclipse

As you may already know if you are a mobile developer, Android development is not exactly what we would call “painless.” At my current client, we are developing a mobile application using a web view which has Android and iOS wrappers pointing to it. The Android wrapper is not overtly complicated, but an extremely important component of our application. We are using Eclipse to develop our Android wrapper, and I have experienced a few issues that can be fixed with some rather unconventional solutions.

Tip #1: When in doubt, clean your project. If you have used Eclipse before, you know it’s not always the most user-friendly tool. Pretty much any time I need to make an edit to our Android wrapper, I get some kind of unknown error for no apparent reason.  To resolve this issue, click the “Project” button at the top of Eclipse and then “Clean…” on the drop down menu. This will get rid of most unknown errors.

Tip #2: I instantly close and restart Eclipse and what do you know, no errors! I tend to get a lot of errors when I import a new project into the workbench.  It might sound like a ridiculous solution, but whenever I import a new project, a best practice is to close and restart Eclipse to avoid unknown errors. When using Eclipse, it’s pretty amazing how many different scenarios can fix a daunting bug just by closing and restarting the program.

Tip #3: Make sure when you use the package name somewhere that it matches the package name of the project exactly. My last tip might seem pretty obvious, but may also save you a lot of time. For example, in the method for the app’s barcode scanner we have a reference to the package name. We have a few different Android versions of the code and they all have different package names. When we changed the package names, in one of the versions, the reference to the package name in the barcode scanning method was not identical to the package name of the project. When you refactor a package name, Eclipse tries to help you by changing all the subfolders with the package name. Unfortunately, because our package name was referred to in a method, this one instance was not edited by Eclipse and led us on a wild goose chase wondering why the bar code scanner was suddenly not working. Moral of the story, make sure your package names are consistent throughout your project.

Though these three tips seem pretty simple, they can save you a lot of time and effort. Eclipse gives us the ability to create Android code, but it definitely has its flaws. Fortunately, Android Studio is in the works which hopefully will have the same power as Eclipse, help make Android development a little less painful, and have a few less irritating bugs for us to deal with in the future.

Phone: 312-602-4000
222 W. Adams
Chicago, IL 60606
Show Buttons
Share On Facebook
Share On Twitter
Share on LinkedIn
Hide Buttons