Thursday, March 8, 2012

App Development Tips & Tricks

Here's a few tips and tricks in developing Android apps using Eclipse.

1. Don't try to run a project while you've got an XML file open and active - Eclipse will create an *.out.xml file and fail to run. Delete the out.xml, close (or make inactive) the XML file you had open, then run the project again.

2. Eclipse usually rebuilds a project when you edit any aspect of it. but it will only recreate the apk file when you run it in the emulator (or on an attached device). If you want the recreate the apk without having to run (as I do sometimes when I've made minor changes and I just want to update the apk) there's an option in Eclipse for that: in Eclipse --> Preference, search for Build. You'll see Android-->Build, and uncheck the Skip Pacakging... option.

3. If you don't use a version/source control system, you can revert to a previous version of code by using the Local History option. Right-click a file within a project and choose Replace With --> Local History and browse for the file. Otherwise install something like Subversion.