Sunday, July 13, 2014

Refactoring in Android Studio

I'm a bit of a dinosaur. My preferred development environment is unix. It's fast. I know how to use all of the tools I need to use. It's on both my home and work computers.

Nevertheless, I have been trying to evolve. I've been doing all of my Android development using Android Studio. It has been going well. I love the code completion. It's the only way to visually add widgets to an app and see the xml updates in real time.

Recently, I ran into a snag. I tried to use the "Refactor" feature in Android Studio to rename one of my classes from "Broadcast_receiver_handler" to "BroadcastReceiverHandler". The file and class name were updated and references seemed to be as well. Since it worked so well, I went on to refactor a bunch of other classes.

Today, while testing the app, I noticed some things weren't working so well. Without going into much detail, I found out that there was one place where the name for my Broadcast_receiver_handler was not updated, the AndroidManifest.xml.

One factor that made debugging more difficult was that Android Studio deleted and added files during the refactor process. I would have rather it did a "git mv" so that diff's would work better.

These are minor issues. I'll continue using Android Studio. It's only a 'beta' release now, so it should improve over time. But for some things, like global file and text manipulation as well as git commands, I will stick with a unix terminal.

No comments:

Post a Comment