R.id is not resolvable

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

R.id is not resolvable

Postby pscoe2 » Fri Feb 01, 2008 4:56 pm

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import android.app.Activity;  
  2.  
  3. import android.os.Bundle;  
  4.  
  5. import android.util.Log;  
  6.  
  7. import android.view.View;  
  8.  
  9. import android.widget.Button;  
  10.  
  11. import android.widget.EditText;  
  12.  
  13.  
  14.  
  15. public class database extends Activity {
  16.  
  17.         @Override
  18.  
  19.     public void onCreate(Bundle icicle) {
  20.  
  21.         super.onCreate(icicle);
  22.  
  23.         setContentView(R.layout.main);
  24.  
  25.  
  26.  
  27.         final Button send = (Button) this.findViewById(R.id.send);  
  28.  
  29.         final EditText userid = (EditText) this.findViewById(R.id.userid);  
  30.  
  31.         final EditText password = (EditText) this.findViewById(R.id.password);  
  32.  
  33.         final EditText from = (EditText) this.findViewById(R.id.from);  
  34.  
  35.         final EditText to = (EditText) this.findViewById(R.id.to);  
  36.  
  37.         final EditText subject = (EditText) this.findViewById(R.id.subject);  
  38.  
  39.         final EditText body = (EditText) this.findViewById(R.id.body);  
  40.  
  41.     }
  42.  
  43. }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4



says R.id is not resolvable and gives error.....can nyone tell how to manage such problems
pscoe2
Freshman
Freshman
 
Posts: 2
Joined: Fri Feb 01, 2008 4:32 pm

Top

Postby plusminus » Sat Feb 02, 2008 12:46 am

Hello pscoe2,

Do you see a R.java in package explorer :?:
Is the Class you posted in the same folder as the R.java :?:
If not: Organizing Imports (CTRL + SHIFT + O) should do the job. Or do import "R" manually, like:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import org.anddev.android.andnav.R;
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Hope I could help you. :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby pscoe2 » Sat Feb 02, 2008 5:30 am

it is in the same folder yet it is giving that problem....
so if u can suggest something else
pscoe2
Freshman
Freshman
 
Posts: 2
Joined: Fri Feb 01, 2008 4:32 pm

Postby plusminus » Sat Feb 02, 2008 11:44 am

Hello pscoe2,

if the R.java is in the same package as your MYActivity.java you wont need to import anything.
Its perhaps a problem that your R.java is not being updated ... (post its content here (or you'll see it by yourself))

There have been others complaining about Not updating R.java.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby bavarol » Mon Feb 04, 2008 7:50 pm

A developer has reported this bug, it's usually solved like that:

http://groups.google.com/group/android- ... 0191a7d228
To import new files, select the project in the project folder, and
press F5 (refresh), then you should have your new image accessible.

I had the strange thing of R file missing yesterday, too. It was
really annoying, and I tried many things (closing / opening project,
New / load existing project) that did not help.

In the end, I did:
1) Project - uncheck Build automatically
2) Build working set / select working set / select the resource
generator
3) build manually

with a bit of luck and further playing around, R should reappear.


I hope, that's what you wanted.
bavarol
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Mon Dec 10, 2007 9:19 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests