1

I've been having trouble trying to get the damn R.java to generate. I've tried almost everything. Check everything was up to date in the sdk manager, cleaned my projects, made sure they build automatically, closed and reopened eclipse, ran it as admin, clicked fix properties, made like 6 new projects(still no R.java), deleted everything in the gen file(autogenerated buildConfig, but still no R.java), made sure my build target was the same one on my manifest.xml, my programs don't have any errors, R class isn't being imported in my mainActivity. The only errors I have is in the mainAtivity, where the R class is being used. For the time being, those lines are commented. My test programs run, but I know I'll need that R class in the future.

Commented lines:

setContentView(R.layout.activity_main_activity_ts);

if (id == R.id.action_settings) 
{
    return true;
}

 getMenuInflater().inflate(R.menu.main_activity_t, menu);

I don't know what else to do. On my desktop, everything worked fine, since day 1. On my laptop, at 1st I had duplicated dependencies(I think I fixed it cause they're aren't any errors). Also, for some reason, I always get this error on appcompact_v7.

Unable to resolve target 'Google Inc.:Google APIs:21' until the SDK is loaded. Eclipse has been running for an hour now and that still hasn't loaded.

Any help would be greatly appreciated. I've had urges to program, but this problem is preventing me from doing what I love :(

Mohammad Rahchamani
  • 5,002
  • 1
  • 26
  • 36
user3842769
  • 95
  • 1
  • 2
  • 10
  • Check [this](http://stackoverflow.com/a/15761439/2864464) answer out. – Alexander Kohler Nov 20 '14 at 18:26
  • I actually tried everything he suggested like 20 mins before asking for help lol – user3842769 Nov 20 '14 at 18:32
  • Ahh his post has bailed me out a couple times. Best of luck figuring it out man. R not generating has been a blocking point for me way more times than I'd like to admit.. – Alexander Kohler Nov 20 '14 at 18:34
  • the only thing I didn't do(I wasn't sure which xml file he was referring to) was the 1st line where it says "Make sure that anything the R. links to is not broken. Fix all errors in your XML files. If anything in the ADKs are broken, R will not regenerate." – user3842769 Nov 20 '14 at 18:35
  • @AlexanderKohler don't say that, please!!!! lol my hopes and dreams are being shattered :( – user3842769 Nov 20 '14 at 18:36
  • should I just switch to android studios? I was told it wasn't good for big projects and I have a few app ideas and some are big – user3842769 Nov 20 '14 at 18:38
  • I think he means literally every XML file, the layouts can be a problem typically, but that would't make sense as you're creating new projects and still getting the same error. Do you have your build paths set up correctly/is your SDK linked correctly? – Alexander Kohler Nov 20 '14 at 18:39
  • Hahah they're all learning experiences I get past eventually ;) You could give android studio a try, however, I've only ever used Eclipse so I can't really give you an unbiased opinon. – Alexander Kohler Nov 20 '14 at 18:45
  • how can I check if my sdk is linked correctly? laiello asked the same question – user3842769 Nov 20 '14 at 18:47

2 Answers2

1

Can't believe how I fixed it... I switched to android studios and DONE! Worked on the 1st try, no errors, could deploy on my phone quickly and with such ease. Lol

user3842769
  • 95
  • 1
  • 2
  • 10
0

Try deleting the "gen" folder, then rebuilding. Eclipse should generate another R.java for you. I realize you deleted everything inside it, but delete the whole folder and see if that works.

Lawrence Aiello
  • 4,560
  • 5
  • 21
  • 35
  • Are you sure the SDK is linked correctly with eclipse? – Lawrence Aiello Nov 20 '14 at 18:27
  • I think so. I erased the sdk like 3 times, followed, 3 different tutorials on how to install it. Tried using the android and eclipse bundle(is a no go) and recently I'm running eclipse with the android plug in. – user3842769 Nov 20 '14 at 18:31