1

I was trying to import an Eclipse "library project" as module to Android Studio.But I am consistantly getting "Cannot find R.java" error.The weird thing is the module has already R.java in /gen file.What am I supposed to do?

Thank you in advance!

EDIT:I have already an app in Android Studio.Now I am trying to import a library project to it.So what I am doing is open the project(my actual app),then File-Import Module in Android Studio.But getting the above error.

Zapdos
  • 617
  • 1
  • 6
  • 23

2 Answers2

0

You need to import your library using gradle (assuming you are using gradle). After that you would have several R.java to choose from based on their package.

Doron Yakovlev Golani
  • 5,188
  • 9
  • 36
  • 60
  • Thank you but what I am doing is, I export gradle file from eclipse,then open Studio, File-Import new module.I am doing this because this is a library project.Not the actual app.So any other method? – Zapdos May 06 '15 at 14:13
  • When you open the library jar in Studio (with the new decompiler), are you able to see the R.java file and its contents. If not that might an issue either in the import or the jar itself. I haven't written libraries so I am not sure what is the difference between building them and a regular app. It might be worth trying to import the library to a regular app project and see if you can use it the same way. – Doron Yakovlev Golani May 06 '15 at 14:21
  • Not sure exactly what is wrong - it might still be gradle import issue. Be sure that you've done that correctly and the library is picked up (can you use other parts of it). Restart never hurt any one and sometime helps fixing glitches. – Doron Yakovlev Golani May 06 '15 at 14:32
0

Try this File > Settings > Compiler > check use-in progress checkbox. then rebuild the project. I hope it helps.

Roon13
  • 387
  • 2
  • 23