2012-10-25

Eclipse Juno problem building Android NDK

When building code from the Android NDK Beginners Guide, simply trying to get a tutorial on OpenSL to run, I ran into some freaky and troublesome bugs with Eclipse.

Code from Chapters 1-5 built without a hitch.  Starting with Chap. 6,  I started having strange intermittent problems. I could import a project, build it and run it, but then I'd do a double take when errors started popping up all over the place, without having made any changes.

I was getting "Field could not be resolved" and "Function could not be resolved" under the Problems tab whenever I tried to build the project.  If I build from the command line, I can get the project to "Run as Android Project" even right inside Eclipse, however, as soon as I open a file for editing, little red error X's start popping up all over everything.  I spent hours and hours trying to check paths and properties, and project configuration, and even my .bashrc and .profile files.  ANYTHING to hunt down and fix this.

Finally, I went to Project/Properties/C-C++ General/Code Analysis and un-checked a couple boxes:
Field could not be resolved
Function could not be resolved


NOT an ideal solution, because now I won't get nice error highlighting for miss-spelled function names etc... BUT now it works inside Eclipse.  This can be set on either a Workspace or Project level, by the way.

Apparently the issue is with the Indexer.  The Eclipse Juno Indexer has a bug where in some situations it will give erroneous validation.  This, in turn, log-jams the build/run process, stopping it in it's tracks based on imaginary errors.  Another way to get around it is to simply right-click on the errors in the "Problems" Tab at the bottom of Eclipse, and delete them.

I'll be doing some updates to see if this bug has already been addressed, I hope so.

No comments:

Post a Comment

Let me know what you think!