1

I'm developing a new project where I'm using some code from other project.

Yesterday, I copied the files I needed from the other project to the new one. But I saw that it didn't recognize some textview's and seekbar's IDs. So I do make clean to the project and the R.java file disappeared.

I've read that is something that happens to many people but I don't know how to solve.

Today, I've started a new project, and instead of copying the old files, I've created new ones and pasted the code that I only need. But the problem continues. In the java files, it doesn't recognize the layout object's IDs.

Whats the reason why this happens and how can i solve it??

BenBarnes
  • 19,114
  • 6
  • 56
  • 74
masmic
  • 3,526
  • 11
  • 52
  • 105

1 Answers1

1

1. go to project in file menu of eclipse than click on Build Automatically, if its not showing tick Symbol !

2. if you have import android.R; than remove it it should be of import your_package_name.R;

Tarsem Singh
  • 14,139
  • 7
  • 51
  • 71
  • No, I think that when you copy a part of code from other project, the R is imported from that porject. If you save the new one having this import on your file, the R.java file dissapears. If started a new project. – masmic Jul 24 '13 at 10:43
  • @masmic_87 you will have to delete that import also ! – Tarsem Singh Jul 24 '13 at 10:47
  • Started a new Project. Everything ok until now. I've created some layout whithout warnings but in the java file, it appears like it isn't created: " X cannot be resolved or is not a fied". – masmic Jul 24 '13 at 12:08
  • go to project in file menu and check build automatically is ticked or not ? – Tarsem Singh Jul 24 '13 at 12:26
  • Yes, is ticked. If done all the things that are said to do: Cleaning, fixing, I don't know what more to do... – masmic Jul 24 '13 at 12:37
  • I understand that for first declare an Id, @+id is used. I use @+id. The thing is that I've developed 2 parts of the app independetly. And now i need to join booth and continue developing. The problem is that when I copy the files into the new project, the new layouts don't save the Ids in the R.java, so the java files don't find no the layout neither the objects. – masmic Jul 24 '13 at 12:49
  • why did you not mentioned this earlier ? than you will have to manually import the R in your project with package name in new xml files ! like import yourpackagename.R; for all new xmls which are to be used ! – Tarsem Singh Jul 24 '13 at 12:53
  • The thing is that I don't want to import any package. I'm creating a new project taking parts of code from the other projects. I get to a piont where it doesn't let me to run the project, is says that the project has errors, but I don't see any file whith errors. – masmic Jul 24 '13 at 13:22
  • SOLVED! I was copying the strings from the other project to the new one. When creating one by one new ones for the new project, no problems are created. Thanks for your help. – masmic Jul 24 '13 at 13:45