eclipse - R cannot be resolved - Android error -
i downloaded , installed new android sdk. wanted create simple application test drive it.
the wizard created code:
package eu.mauriziopz.gps;  import android.app.activity; import android.os.bundle;  public class ggps extends activity {     /** called when activity first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);     } } but eclipse gives me error
r cannot resolved
on line
setcontentview(r.layout.main); why?
ps: have xml file named main.xml under res/layout/.
after tracking down problem well, found note in android documentation:
http://source.android.com/source/using-eclipse.html
*note: eclipse likes add "import android.r" statement @ top of files use resources, when ask eclipse sort or otherwise manage imports. cause make break. out these erroneous import statements , delete them.*
while going through android sample tutorials, use ctrl + shift + o command "organize imports" , generate missing import statements. generate incorrect import statement hide r.java class automatically generated when build.
Comments
Post a Comment