Forums Register Login

XML files not being recognized/resolved - SOLVED!

+Pie Number of slices to send: Send
I've just done a fresh re-install/extract of Eclipse off Android's website, hardly added much code or XML to my project, yet nothing's being recognized outside of my MainActivity.java. And before you ask-yes, I've tried cleaning and restarting Eclipse. I've also tried moving out my Gen folder to let Eclipse generate another Gen folder, which generates another R.java file since that seems R.java seems to be connected with reference problems.

(see comments for where the errors are) For example, in the first method (onCreate), the second like there's activity_main that Eclipse is saying it can't resolve, as if it doesn't exist. Consequently, my CreateLG button in the onCreateLGClick method isn't resolved/recognized either. Neither is the main (.xml) or createlg_menu (.xml) resolved..

MainActivity.java:


Here's the other files in case you want to see them:

activity_main.xml:


createlg_menu.xml:


main.xml:
1
+Pie Number of slices to send: Send
Are layout.activity_main and menu.main present in the R.java file?
+Pie Number of slices to send: Send
I believe so, unless I'm reading it wrong:
R.java:

1
+Pie Number of slices to send: Send
Ok, then you must be referencing the wrong R class. Remove this import: import android.R;
+Pie Number of slices to send: Send
Just tried, didn't work unfortunately. Doesn't make much sense.. especially since I just reinstalled Eclipse and only added one button, some code, and one xml file
1
+Pie Number of slices to send: Send
In Eclipse, hover-over the R and see what class it reports.



It should be com.example.groceryrunner.R
+Pie Number of slices to send: Send
Nope, doesn't say that:
+Pie Number of slices to send: Send
That's what I thought. You have to track-down where/how you are referencing android.R instead of com.example.groceryrunner.R. Check again to make sure you have removed the import for android.R.

You could also replace R.menu.main with com.example.groceryrunner.R.menu.main, but better to find where the reference to android.R is sneaking-in.
1
+Pie Number of slices to send: Send
Ryan - check PM.
+Pie Number of slices to send: Send
MOTHERS OF NEPTUNE'S PEARLS you were right. I deleted the import again and commented out the lines that had the errors. Restarted Eclipse, Built All, and uncommented the code and wa-la! All's fine now! :Cyber-Five: Thanks for all the help, this errors been plaguing me for 2 days now, couldn't get anything done, now I can march on forth..
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 33036 times.
Similar Threads
Menu not displayed
an error in android studio:Execution failed for task ':app:mergeDebugResources'.
Cannot resolve symbol R
Preferences overlaps navigation drawer
What to do about NullPointerException when trying to grab RelativeLayout and add views to it?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:12:19.