javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
03/09/12 02:50 PM (13 years ago)

Android Errors relating to R.id fields

Hi Guys, I've gotten rid of most of the errors in my application relating to the BTM plugins, but the rest of the errors pertain to the references to the R.id fields. Here's an example of one of the 74 errors I get :P containerHorizontalButtons cannot be resolved or is not a field BT_screen_menuButtons.java /BT_activity_root/src/com/APPNAME line 187 Java Problem On line 187, the code is: containerHorizontalButtons = (LinearLayout) thisScreensView.findViewById(R.id.containerHorizontalButtons); This error occurs almost every time the code uses the (R.id). Does anyone have any ideas? I've tried cleaning the project a billion times. Thanks so much for your help, couldn't do this without all of you :P
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
03/09/12 03:06 PM (13 years ago)
Do you have the correct API installed and configured for this app? That's always the first thing to check. Also, try to right-click on the projec, go to Android Tools, Fix Properties. Mark
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 03:11 PM (13 years ago)
Thanks, I'll check that. I'm using API 8 from memory. I just cleaned the project and it now says : Showing 100 of 353 errors R cannot be resolved to a variable The R file is also missing from the gen folder. I'll check my APIs and fix properties and get back to you.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 03:16 PM (13 years ago)
Okay, All the settings look fine. Right clicking and fixing properties didn't seem to do much at all. Frustrating! Never happened to me on one of my OWN apps, has to happen on a client's app. Just my luck, I suppose. The issue appears to be that the java file that should be in /gen isn't generating. Not sure how to manually generate it.
 
Zackamo
Aspiring developer
Profile
Posts: 175
Reg: Oct 25, 2011
Bryan TX
3,400
like
03/09/12 03:22 PM (13 years ago)
Now by no means do I have any idea what I am about to talk about, I recently was messing around with some stuff trying to bring in a third party sdk, and saw some similar stuff. R.java is file you can find in your Gen folder. Its auto-generated and changes as you change other stuff. From what I have learned, parts are based off of stuff in your RES folder, particularly your strings and style. Here its looking for what should be in your strings xml, located in res. Check your strings, and if its not there then you know whats up. If it is there, I would check your project properties that you have tagged apis, and have a correct java build path. FYI - I don't have that line in my BT_activity_root. I do have it in BT_Screen_menuButtons.java
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 03:23 PM (13 years ago)
Yeah, the issue is that the R.java isn't being generated. I was initially generated, and it caused even more errors that I cleaned the project, and it disappeared!
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 03:25 PM (13 years ago)
Found something else that might be causing an issue: [2012-03-10 09:25:05 - BT_activity_root] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties. However, nothing happens when I try to fix project properties. Weird! EDIT: now this shows up in the console too (although I think it's unrelated) [2012-03-10 09:25:57 - BT_activity_root] res\layout\menu_list_rowsimpleadvancedBackup.xml: Invalid file name: must contain only [a-z0-9_.] [2012-03-10 09:25:57 - BT_activity_root] res\layout\screen_menulistsimpleadvancedBackup.xml: Invalid file name: must contain only [a-z0-9_.]
 
Zackamo
Aspiring developer
Profile
Posts: 175
Reg: Oct 25, 2011
Bryan TX
3,400
like
03/09/12 03:28 PM (13 years ago)
Consider restarting eclipse, and or bringing in the project again. I think we need it to properly build the R.java file..
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
03/09/12 03:28 PM (13 years ago)
I'd try downloading your source again. It's very possible that something got corrupted. Save the old source, though, just in case you need to go back. Mark
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 03:29 PM (13 years ago)
@GoNorthWest- as I'm still having issues with my server API key, I can't redownload the source. Hope that issue gets resolved soon too. EDIT: seems to be working now, must have been fixed overnight. EDIT2: I've also tried restarting Eclipse a gazillion times. Lawl.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
03/09/12 03:29 PM (13 years ago)
And @Zackamo's ideas are excellent ones as well!
 
Zackamo
Aspiring developer
Profile
Posts: 175
Reg: Oct 25, 2011
Bryan TX
3,400
like
03/09/12 03:34 PM (13 years ago)
Hey Javooo just saw your compliance problem. Click properties and change your Java Build to 1.6. That should fix it, and I bet it will fix all your other errors.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 03:38 PM (13 years ago)
Okay, changed the Java Build to 1.6 and got this error in the console: [2012-03-10 09:37:00 - BT_activity_root] /BT_activity_root/gen already exists but is not a source folder. Convert to a source folder or rename it. Appreciate your help! The other errors have now changed, they now say something like: checkboxView cannot be resolved or is not a field BT_screen_settingsLocation.java /BT_activity_root/src/com/APPNAME line 329 Java Problem
 
Zackamo
Aspiring developer
Profile
Posts: 175
Reg: Oct 25, 2011
Bryan TX
3,400
like
03/09/12 03:41 PM (13 years ago)
hmmnn do as it asks.. Rename it, see what happens. The gen stuff will continue to haunt you until we can figure out whats going on.. If you have rebooted eclipse I would do it, and unless you have done custom code, I would go back to the zip of your last download and start with fresh source
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 03:44 PM (13 years ago)
What's the best way to rename it? I renamed it in Explorer, then re-added the project to Eclipse and now I'm back where I started: "R cannot be resolved to a variable" Dammit iOS is sooo much easier EDIT: Gone to a fresh source and am back to the bit where it says /gen already exists.
 
Zackamo
Aspiring developer
Profile
Posts: 175
Reg: Oct 25, 2011
Bryan TX
3,400
like
03/09/12 03:58 PM (13 years ago)
Are you clearing from workspace too? Do this.. delete project from eclipse.. Delete projects workspace folder (by browsing to workspace folder).. Check original source and make sure it has a gen folder. I just checked a zip and mine does. If you recently downloaded this, I guess there is no reason not to believe that this could be a hiccup from the transition and perhaps it miss-built that folder.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 03:58 PM (13 years ago)
Okay, I read somewhere that having caps in your project can cause errors with the /gen/ folder. I now get this error in the console: [2012-03-10 09:56:25 - BT_activity_root] res\layout\screen_menulistsimpleadvancedBackup.xml: Invalid file name: must contain only [a-z0-9_.] The errors are now these again: checkboxView cannot be resolved or is not a field BT_screen_settingsLocation.java /BT_activity_root/src/com/APPNAME line 329 Java Problem I think that maybe fixing the invalid file name might help. Anyone have any other ideas? I might even pay someone who can help me out here EDIT: @Zac, I'm starting with a fresh workspace folder each time, and they contain the sourec folder. I'm unzipping the code each time I restart to ensure it's fresh.
 
Zackamo
Aspiring developer
Profile
Posts: 175
Reg: Oct 25, 2011
Bryan TX
3,400
like
03/09/12 04:00 PM (13 years ago)
Do you mind sending me your source? I'll check it out to see if I have any problems building it. Zack84a gmail d0t c0m
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 04:03 PM (13 years ago)
Is that Zack84 @ ? You've got mail if it is.
 
Zackamo
Aspiring developer
Profile
Posts: 175
Reg: Oct 25, 2011
Bryan TX
3,400
like
03/09/12 04:06 PM (13 years ago)
Hadn't gotten it. Note i put zeros and stuff in, just trying to prevent crawlers from picking up my email... zack84a is my gmail address.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 04:07 PM (13 years ago)
Yeah, i noticed that. I sent it to zack84 rather than zack84a, my bad. Resending
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 04:39 PM (13 years ago)
After I fixed the file names for the dodgy files, most of the errors were fixed. I'm now left with 4 that won't seem to go away: descriptionView cannot be resolved or is not a field BT_screen_menuListSimpleAdvanced.java /BT_activity_root/src/com/APPNAME line 834 Java Problem menu_list_rowsimpleadvanced cannot be resolved or is not a field BT_screen_menuListSimpleAdvanced.java /BT_activity_root/src/com/APPNAME line 826 Java Problem The public type BT_screen_menuListSimple must be defined in its own file BT_screen_menuListSimpleAdvancedBackup.java /BT_activity_root/src/com/APPNAME line 73 Java Problem The type BT_screen_menuListSimple is already defined BT_screen_menuListSimple.java /BT_activity_root/src/com/APPNAME line 73 Java Problem Any ideas? Cheers guys, you've been soo much help.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
03/09/12 05:27 PM (13 years ago)
Try the project without that 3rd party menulistsimpleadvanced plugin, just to see if it's clean without it.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 05:29 PM (13 years ago)
@raveyd, It works, bar the last error. However, I am aware that menulistismpleadvanced does work for Android, and I do need it to work. These errors don't seem too bad (compared to the 400 I was receiving before I fixed up the BTM plugin file names) , so I'm hoping someone can help me sort them out. Cheers again.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
03/09/12 05:35 PM (13 years ago)
It looks to me like a conflict between menusimple and menusimpleadvanced - both defined as the same activity perhaps? Do you need the activity.java files for both of these, or can you remove the menusimple activy, if you really need to use the advanced plugin.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 05:37 PM (13 years ago)
Hmm, I'll try removing the files for the simple menu. //J
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
03/09/12 05:42 PM (13 years ago)
And any references to it, like in the layout xml files.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 05:47 PM (13 years ago)
I removed the menu simple java file, however, in the menu advanced file it seems to reference it public class BT_screen_menuListSimple extends BT_activity_base implements OnScrollListener{ Anyway, after removing the simple java file, I cut down on 1 error, leaving these: descriptionView cannot be resolved or is not a field BT_screen_menuListSimpleAdvanced.java /BT_activity_root/src/com/APPNAME line 834 Java Problem menu_list_rowsimpleadvanced cannot be resolved or is not a field BT_screen_menuListSimpleAdvanced.java /BT_activity_root/src/com/APPNAME line 826 Java Problem The public type BT_screen_menuListSimple must be defined in its own file BT_screen_menuListSimpleAdvancedBackup.java /BT_activity_root/src/com/APPNAME line 73 Java Problem Any other ideas? Think about the $$ lol.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 06:43 PM (13 years ago)
No one? Happy to send the source code if necessary.
 
javooooo
buzztouch Evangelist
Profile
Posts: 719
Reg: Jun 17, 2011
Sydney, Austral...
18,490
like
03/09/12 07:47 PM (13 years ago)
Here's the latest. I removed some of the conflicting code, and got it so there were no errors, but now it just crashes as soon as you open the app (it shows the nav bar). Something must be up with what I changed with the menu. Any help at all would be greatly appreciated.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
03/10/12 07:04 AM (13 years ago)
Send it over, I'll take a look. No guarantees though! paul9qr at btinternet d0t c0m Would it be possible to send the source with the MenuSimple java file still included?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.