Christopher Francisco
Christopher Francisco

Reputation: 16288

issues with Eclipse and references on Android projects

So I opened a project, went to Activity1.java, changed a boolean value from false to true and ran. I got a null pointer exception on a TOTALLY UNRELATED class. Seems like a call to findViewById is returning null for some XML layout ID.

How is that even possible? this is not the first time eclipse does that. Previous times it gave some errors like "You cannot cast an ImageView to a Button.... and that's NOT what was happening, it was fixed rebooting eclipse after 15 mins.

is there any cache or something that might be the cause of this issue?

Upvotes: 0

Views: 24

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007544

How is that even possible?

I haven't run into it as a problem in quite some time, but the compiled version of your resources apparently got out of sync with the compiled versions of the Java classes referencing those resources. Project > Clean from the Eclipse main menu solves this.

Make sure you are on a relatively recent version of the ADT plugin for Eclipse (current version: R22).

Upvotes: 1

Related Questions