1. Eclipse refuses to generate a new .APK, instead generating a popup chiding you for having the gall to include error(s) in your code, as here.
(X) Your project contains error(s), please fix them before running your application.
2. Your code looks fine. No red stuff anywhere near your files.
3. Travel up the project tree and notice R.java (the automatically generated resource file) is red.
Solution(s):
Basically, Eclipse is telling you there's a problem in a resource file, but it didn't figure this out until you tried to run the code. Follow the red. It's designed to help you locate the source of your pain.
Solution 1:
Be Fearless! Dive into R.java to find the problem. That's right, open it up and look inside. In my case, it was a typographical error (a single tiny tick mark added inadvertently to the end of the text) in the strings.xml file. The offending string was clearly marked in red, so it was trivial to find and fix the typo.
Solution 2:
If that doesn't get you out of your funk, try this. Technically, it deals with a missing R.java file, but the root cause is very similar.
Solution 3:
Here's another idea to try.
Solutions #2 and #3 were found here.
Solution 4:
Watch this video. There's an example of how to generate (and resolve) a similar condition beginning at frame time 20:32. We highly recommend watching the whole series, published on YouTube. It provides a good introduction to Android programming using Java in Eclipse. Thanks, Marakana, for providing an excellent video of your boot camp training class.
No comments:
Post a Comment