It seems that the Android SDK doesn't compile my android app correctly. After building an app, I sometimes get seemingly random exceptions. The error goes away if I comment out the offending code, rebuild, uncomment the code, then rebuild again.
For instance, this code gave me a NullPointerException:
playButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { startActivityForResult(settings, PLAY_GAME); } });
There is nothing wrong this code! Yet adb logcat tells me it's the cause of an exception. Commenting out this code, rebuilding, uncommenting and rebuilding, makes the error go away.
What is going on?
This is making developing for android particularly frustrating.
Update: As I pointed out before, these are seemingly random errors that go away once I uncomment/recompile/comment/recompile. So I can't reproduce the stacktrace. It was a NullPointerException if I remember correctly.
However, if it is indeed buggy programming, why is the app running fine now w/o ANY errors at all?
Whenever I make a significant change to the app (add a new resource, a new class, function, etc), old code that was working fine breaks. Why?
Update: Seriously guys, lay off on the hate. I feel like a stumbled on a Atheists vs Christian debate. Sorry to have insunated that android was at fault. Started a new question with the latest errors:
App Ran Fine, Now Breaking for Seemingly Unknown Reasons