Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Find everything you need for the Galaxy S5 and discuss it in our S5 forum!
Have you seen that OnePlus One's awesome camera?? The forum is over here!

test: Reply
 
LinkBack Thread Tools
Old July 12th, 2010, 10:21 PM   #1 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Apr 2010
Location: los angeles, ca
Gender: Male
Posts: 50
 
Device(s): Samsung Galaxy Note II (SGH-T889), Samsung Galaxy Tab 2 7". Samsung Galaxy Blaze, Google Nexus 10
Carrier: Not Provided

Thanks: 3
Thanked 0 Times in 0 Posts
Send a message via AIM to PerfectReign
Default Android Notepad Example?

Having completed a few "Hello World" type apps for examples, I wanted to move on to a notepad style sample. Especially since my MyTouch doesn't have a notes application.

Notepad Tutorial | Android Developers

I - however - get many errors when loading even the solution. It keeps saying R. doesn't exist.



Any ideas why this is? I don't notice a forum on the Developer Forums.

PerfectReign is offline  
Reply With Quote
sponsored links
Old July 13th, 2010, 12:14 AM   #2 (permalink)
Junior Member
 
Join Date: Jun 2010
Location: Wisconsin
Posts: 29
 
Device(s): Motorola Droid 1
Carrier: Not Provided

Thanks: 2
Thanked 1 Time in 1 Post
Default

Do you have the layout in your res/layout/ folder?
Jacob Malliet is offline  
Reply With Quote
Old July 13th, 2010, 02:30 AM   #3 (permalink)
cp1
Member
 
Join Date: Apr 2010
Posts: 375
 
Device(s):
Carrier: Not Provided

Thanks: 13
Thanked 35 Times in 30 Posts
Default

It was called notes_list in the example I followed -- they may have changed it since. Make sure you actually have the xml file in the right place and that it's saved (otherwise it won't automatically add the correct ID).

If that doesn't work try project -> clean and there is another good one, something like "fix problems with project," but I can't find the menu option right now.

ctrl-shift-o is always a good one to try, but I don't think that's the case here.
cp1 is offline  
Reply With Quote
Old July 13th, 2010, 05:31 PM   #4 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Apr 2010
Location: los angeles, ca
Gender: Male
Posts: 50
 
Device(s): Samsung Galaxy Note II (SGH-T889), Samsung Galaxy Tab 2 7". Samsung Galaxy Blaze, Google Nexus 10
Carrier: Not Provided

Thanks: 3
Thanked 0 Times in 0 Posts
Send a message via AIM to PerfectReign
Default

Thank you for the tip.

I ran that, and it added an import line for the android.R class. However, I still get the error.

I also noticed on the type-ahead that the notepad_list is not part of the R.layout class.

PerfectReign is offline  
Reply With Quote
Old July 13th, 2010, 06:18 PM   #5 (permalink)
New Member
 
oldman's Avatar
 
Join Date: Jun 2010
Posts: 12
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 4 Times in 2 Posts
Default

A couple of things without seeing your full code:
1. I find it best to always Save, Refresh and Clean
2. After an error - delete the Out file that gets created (it will show up in the folder with the file that caused it (usually one of the xml's)
3. Don't Import the R.class file
4. Eclipse is very picky about syntax and when using the auto/suggestion, as in findViewById(R.id.layout) - type it in rather than using the suggestion - sometimes (not always) there seems to be a hidden character - trust me, I discoverer this many times. It's a bug.
5. Regarding your specific problem: again back to 'syntax' Don't use: upper case, numbers or ANYTHING other than lowercase and no symbols or dashes or underlines. Especially for resources.
oldman is offline  
Reply With Quote
Old July 13th, 2010, 06:26 PM   #6 (permalink)
cp1
Member
 
Join Date: Apr 2010
Posts: 375
 
Device(s):
Carrier: Not Provided

Thanks: 13
Thanked 35 Times in 30 Posts
Default

It looks like you have another error below -- make sure all your errors are fixed first (especially brackets and semi-colons).

Can you post a screenshot of your project files (expand the src and layout boxes).
cp1 is offline  
Reply With Quote
Old August 23rd, 2010, 09:57 PM   #7 (permalink)
New Member
 
Join Date: Aug 2010
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've also encountered the same problem with the second version of the notepad tutorial. For some reason it just doesn't generate the R.java class, which I assume is the cause of all the errors.
AmitNHB is offline  
Reply With Quote
Old August 24th, 2010, 07:09 AM   #8 (permalink)
New Member
 
Join Date: Aug 2010
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

I looked into notepad application folders, there is no R.java present under gen folder.

I think that is the reason why the error.

I tried with Spinner appliaction which doesnt show up errors.
santoshmadalli is offline  
Last edited by santoshmadalli; August 24th, 2010 at 10:14 AM.
Reply With Quote
Old September 9th, 2010, 08:45 PM   #9 (permalink)
New Member
 
Join Date: Aug 2010
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am having the same problem and I also do not have the R.java file in /gen. My understanding is that the Android plugin for Eclipse is supposed to auto generate this file, it appears though that it has not. Is there a way to force Eclipse to generate this file? Thanks.

P.S.
I tried using the Android Tools-> Fix Project Properties, this did nothing. I aslo tried building the Solution, but there still was no /gen/R.java.
jetak is offline  
Last edited by jetak; September 9th, 2010 at 08:53 PM.
Reply With Quote
Old November 3rd, 2010, 02:40 AM   #10 (permalink)
New Member
 
Join Date: Nov 2010
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello i am trying the notepad example 2 but the R.java file is not getting generated... it is giving an error as R.layout.Notes_list cannot be resolved...
i am also getting an error in note_edit.xml file as multiple annotations found in LinearLayout
pls help..
nikhildl is offline  
Reply With Quote
sponsored links
Old November 11th, 2010, 09:36 AM   #11 (permalink)
GIR
Junior Member
 
GIR's Avatar
 
Join Date: Feb 2010
Location: UK
Posts: 97
 
Device(s): ZTE Racer
Carrier: Not Provided

Thanks: 21
Thanked 10 Times in 8 Posts
Send a message via Skype™ to GIR
Default

If you right click on the project directory, and then click on Android Tools near the bottom, there is a sub option to fix build, try this, for me in the past this has solved a few niggles, but dont expect miracles

Hope this helps,
GIR
GIR is offline  
Reply With Quote
Old December 15th, 2010, 01:44 PM   #12 (permalink)
New Member
 
Join Date: Dec 2010
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

check to see if you have import android.R; at the top of your source file. That was in mine, as soon as I removed it, I was able to access my own R variables.
foofrog is offline  
Reply With Quote
Old December 15th, 2010, 02:52 PM   #13 (permalink)
Member
 
Join Date: Aug 2010
Location: Norway
Posts: 313
 
Device(s): Samsung Galaxy Nexus
Carrier: Not Provided

Thanks: 0
Thanked 53 Times in 51 Posts
Default

i think the easiest way(maybe the only one) is to create a new project and start typing in the code from the example. This way the R java file is created on the start.
miXer is offline  
Reply With Quote
Old February 2nd, 2011, 06:47 PM   #14 (permalink)
New Member
 
Join Date: Feb 2011
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Smile A Big thanks from across the pond! :-)

Quote:
Originally Posted by foofrog View Post
check to see if you have import android.R; at the top of your source file. That was in mine, as soon as I removed it, I was able to access my own R variables.

A BIG thanks ... that worked for me! Thanks again from across the pond! :-)
versaggi is offline  
Reply With Quote
Old February 3rd, 2011, 04:43 AM   #15 (permalink)
Member
 
Join Date: Aug 2010
Location: Norway
Posts: 313
 
Device(s): Samsung Galaxy Nexus
Carrier: Not Provided

Thanks: 0
Thanked 53 Times in 51 Posts
Default

I also did this tutorial for some time back, but i created the project from scratch, writing everything and had never any problems. I also strongly suggest people do this if they want to learn. To import a finished project is not so educationally as writing the project.
miXer is offline  
Reply With Quote
Old February 26th, 2011, 09:36 AM   #16 (permalink)
New Member
 
Join Date: Aug 2010
Posts: 4
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

When creating the new project, try building against newer target; Android 2.2 (API Level 8). This can be selected at 'Build Target', assuming you have downloaded this version with the Android SDK Manager.

Should work now!
dreamone is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 02:09 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.