开发者

r cannot be resolved on ubuntu + eclipse + android sdk

开发者 https://www.devze.com 2022-12-25 08:56 出处:网络
Hi i have erorr \"R cann开发者_如何学Pythonot be resolved\" everytime when i create android project in eclipse under ubuntu with android sdk. In windows everything ok. What\'s wrong?R is a Java class

Hi i have erorr "R cann开发者_如何学Pythonot be resolved" everytime when i create android project in eclipse under ubuntu with android sdk. In windows everything ok. What's wrong?


R is a Java class created in source form by the build process. It contains definitions of locally unique numbers to refer to the assets under your project's 'res' directory.

See if you have a 'gen' folder in the route of your Eclipse project. Then look in this folder and see if you have R.java class under a package structure representing the same as the 'package' attribute in the manifest tag in your AndroidManifest.xml.

There is a common problem where the 'gen' folder gets deleted by Project->Clean, or where a project is copied from one workstation to another it seems sometimes the 'gen' folder does not get generated. You could try making a 'gen' folder of your own in your project root to see if this fixes it.

If you are referring to this file from a Java file with a package different to this you will have to explicitly 'import' it, but Eclipse should prompt you with assistance about this.


There is one useful trick, you just go to strings.xml and then press space than back space and CRTL+S this will rebuild your code and also generate everything in gen folder that is connected with strings.xml

0

精彩评论

暂无评论...
验证码 换一张
取 消