tags:

views:

40

answers:

1

Now that I sort of know my way around the SDK/API, I've switched from Eclipse back to my favorite text editor, which means I have to use ant to build my project, however:

It seems every other time I compile the project, a lot of drawables get corrupted, resources lose their ids (resulting in NPEs in the code), or classes throw "Verify Errors".

The only way to fix this is by removing the bin and gen folders, and recompiling, which is obviously annoying.

Is there any way to avoid this?

btw, I'm using ant 1.7.1, java version "1.6.0_20"

+1  A: 

It seems every other time I compile the project, a lot of drawables get corrupted, resources lose their ids (resulting in NPEs in the code), or classes throw "Verify Errors".

Resources "lose their IDs" is relatively common, when you change something about the roster of resources (add one, remove one, etc.). You might consider adding an Ant target that does a clean before your debug/install.

I have never seen classes randomly throw "Verify Errors". That occurs when compiled classes try referring to missing stuff, so you might get this when you first try to use a third-party JAR, for example. The only reason I can figure it might occur for you is if you are frequently refactoring your code or something. But I have developed a metric buttload of code using Ant and have never encountered this for any of my own code.

The Ant scripts and associated binaries could use a little work in terms of detecting changes, which is the root of both of these problems.

CommonsWare
Yeah, I've used ant for other projects and it's had these same problems (minus the resources losing their IDs), but on a much much lower scale (maybe a 3% chance of happening). Developing Android, I'd say there's a 70% chance of it happening for me. It's very high, and often I'm not changing much when it does.
synic