R.java disappears after project clean

前端 未结 30 2009
傲寒
傲寒 2020-11-30 05:37

After I added some .png files into my Project Workspace drawable folder I refreshed my drawable folders in Eclipse and the newly added files showed up. But when I tried to a

相关标签:
30条回答
  • 2020-11-30 06:02

    This happens to me if I move my project to a new location. I have found that the answers above didn't fix my problem, but that creating a new project and importing the source did.

    0 讨论(0)
  • 2020-11-30 06:03

    Try editing one line of code in your project, then build the project once more.

    0 讨论(0)
  • 2020-11-30 06:04

    Everytime you clean the project and it rebuilds, it imports

    import.android.R

    so, delete this import and remove all errors from xml files. It will work.

    0 讨论(0)
  • 2020-11-30 06:04

    If you add an external resource file with capital letters for example "Hello.png or WelcomeSound.mp3 etc etc" like if you add upper case letters and clean your project you'd surely loose your R.java file. So if you already lost it, either rename the file externally and then clean your project or else right click on the project Refractor->Rename and then rename your file with all letters in lower casing. Next, delete the 'gen' folder in the project explorer and now right click and "Build Project". If Build Project option is grayed out, go to Project-> Deselect "Build Automatically" option.

    Regards,

    Kshitij Thube

    0 讨论(0)
  • 2020-11-30 06:05

    If you are using 64-bit Ubuntu, try to install the 32-bit libraries (ia32-libs)

    $ sudo apt-get install ia32-libs 
    

    it worked for me

    0 讨论(0)
  • 2020-11-30 06:08

    I have got the same problem after lots of cleaning and building project again and again. I found that on console there is this error:

    res/drawable-hdpi/Blue Blank.png: Invalid file name: must contain only [a-z0-9_.]
    

    and this is not appearing as an error in xml. I changed the name and save the file, clean project and build. Now it's working. My suggestion check your res folder and name of files you use in it and name only [a-z0-9_.].

    Delete related tag in xml, save xml, clean project, build project. Now again put that resource in xml and save!

    0 讨论(0)
提交回复
热议问题