Amar
Amar

Reputation: 997

R.java was modified manually! Reverting to generated version

I added one xml file in layout. After that this error is coming. But the problem is I haven't touched R.java file. Now in my new activity i m going to set its content view as my newly created xml file, but when i m doing R.layout., the newly created xml is not coming in suggestion. Do anybody have any idea how to correct this. I have cleaned my project several times but it is not working.

Upvotes: 4

Views: 23000

Answers (12)

Damodar Periwal
Damodar Periwal

Reputation: 409

It happened to one of my Eclipse projects today. This is what fixed it mysteriously. Don't know why or how.

Changed Properties->Android->Project Build Target to a higher (different) version of Android and hit the Apply button. Then did a clean build. The problem went away.

After the above steps, I could even go back to the original Project Build Target without the problem re-appearing.

Upvotes: 2

F-Fardin
F-Fardin

Reputation: 508

I had similar error, but when I import new project to my eclipse. and the solution was, I should check the option (copy project to work space) specially when our project has library.

Upvotes: 0

Matt
Matt

Reputation: 1

Very late on the scene...

I had this line mysteriously appear at the start of my imports:

import android.R;

I deleted it and shazam error was gone.

Upvotes: 0

Muhammad Usman Ghani
Muhammad Usman Ghani

Reputation: 1279

Right Click on Project->Bulid Path->Configure Build Path ther you see error android-support-v4.jar remove this library and add library again this works fine for me.

Else Try Go to gen Folder delete R.java and from Project option choose Clean Project.

Upvotes: 0

Pavi3l
Pavi3l

Reputation: 11

I had similar problem. Cleaning project didn't solve the issue and there was no error in the code or the uppercase or spaces in file names.

The solution was going to a popup window which came when you choose PROJECT-->CLEAN and then UNcheck the "Start a build immediately" option. Clean the project. Close and reopen Eclipse and then build the project (PROJECT-->BUILD).

The question remains why simple clean and build without closing Eclipse didn't worked.

Upvotes: 0

Bhavin Nattar
Bhavin Nattar

Reputation: 3215

May this Help you...

I think your xml file name might be having some capital letters or some special characters..

Delete them and then try again to run the project..

Upvotes: 1

R9J
R9J

Reputation: 6715

Delete R.java and let eclipse regenerate it, then project --> clean will fix it.

Upvotes: 5

Lunchbox
Lunchbox

Reputation: 1550

There must be some mistake in one of your xml files. Eclipse does not always show error messages if there is something wrong with your xml. Mostly code gets errors, in this case 'R', so you will need to go through your xml manually, it could just be a simple mistake. Good luck

Upvotes: 0

Bhoomika Brahmbhatt
Bhoomika Brahmbhatt

Reputation: 7415

R.java file have all the resources IDs provided to resources(drawables, layouts, styles etc) either by Programmer, or generated through sdk. So check your xml files as well as your drawable folders. If any of them including wrong format it will show an error in R.java file like sometime R.java is not generating or our class file shows R.id.xxx is not found or R.class is not defined error.Then clean your project.

Upvotes: 0

mmoghrabi
mmoghrabi

Reputation: 1291

make sure your not importing any thing that ends with com.R make sure your naming convention of the layout is correct

Upvotes: 0

Nargis
Nargis

Reputation: 4787

Check if you have any existing errors in your code, if yes correct it and then try refreshing and building your Project.If your Project is properly build,you will get the new xml file in suggestion

Upvotes: 2

Tombeau
Tombeau

Reputation: 353

Try cleaning the project this will do the work.

Upvotes: 0

Related Questions