R.java file not getting generated

2020-02-01 07:39发布

问题:

I'm unable to the R.java problem in my half built Facebook app. I have selected the "Build automatically" option, I cleaned my project. I did all the recommended solutions to generate my R.java file.But still no success. I have 2 R.java in my "gen" folder. I have put a screenshot for better understanding.

all the buttons, textview and imageviews are not being recognized.

回答1:

Try this: I have similar problem R.java not found error it is actually not getting generated

I did almost every thing which are said in the different links in the forum

What I did

1.I delete the project from the workspace and re import it,after doing that when the project launched it start giving me the SDK not found error even I was given the correct Android SDK path.I am using eclispe ADT which you can find from android site itself.

2.I don't know why ADT plugin was showing it needs to update even the latest ADT 21.1 is installed .I tried to updated that then ,i don't know how tools folder from my SDK get deleted after that .It start shouting tools folder not found in SDK folder .So I need to download the SDK again and update the ADT plugin to 21.1 .

3 So I think some time there is problem in ADT plugin ,So keep it update correctly or reinstall it will works if nothing else works .



回答2:

I too had similar issue...

I went through many link from Google, but no use. At last I open Android SDK Manager to see if any thing missing from installed packages, and found "Android SDK Built-tools" is not installed.

I installed and follow below steps:
1. re-open eclipse.
2. comment error lines
3. build All
4. uncomment error lines to see if error gone.

Hope this will help someone...



回答3:

Try this:

  1. Delete any import to an R.java class (like @zapl pointed out).
  2. Move your cursor to a reference to any button/layout/string/whatever-coming-from-R, delete the last character, and hit ctrl+space. Eclipse will try to codehint you, automatically importing the correct R.java.
  3. Just to keep it cool, clean and rebuild.


回答4:

It happend to me when I located a png file with a CAPITAL LETTER in its name. The whole name should contain non-capital letters ONLY!



回答5:

I had this problem too. The solution I had was: installing the lib32z1 and lib32stdcc++6, which were missing

sudo apt-get install lib32z1

sudo apt-get install lib32stdcc++6



回答6:

I had to update to latest Android Studio Version (3.3.2 at the moment)