1

When I work on an android application in Eclipse, R.java never appears. I did the following to try to fix it:

  • delete ~/.eclipse folder
  • reinstall eclipse
  • create a new workspace
  • reinstall android developer tools
  • reinstall operating system

None of it worked. Even the Hello World! application that is created by default won't build. What do I have left I can do?

UPDATE:

There aren't any problems in Problems other than the two "R cannot be resolved to a variable"s. The Error Log tab shows an error Failed to load properties file for project from when I created the project. I think that may be a good clue as to what the root issue is.

ANOTHER UPDATE:

It's not a permissions issue, since the same thing happens when I run Eclipse as root. 'Fix Project Properties' does nothing. When I comment out the references to R.java, the problem is not resolved (the reason it doesn't run is [2013-07-08 21:47:37 - AppName] Could not find AppName.apk! )

YET ANOTHER UPDATE:

running eclipse as root works now.

OS is 64-bit Arch Linux

Jakob Weisblat
  • 7,450
  • 9
  • 37
  • 65

3 Answers3

3

Make sure that you have no xml related error( open and check all xml files, including the manifest manually).

Clean your project.

Change the build target version.

Make sure that you have Android SDK build tools. It comes on updating the ADT plugin.

JiTHiN
  • 6,548
  • 5
  • 43
  • 69
0

Try these things:

  1. Check in the properties of the project, in the Android tab if you have downloaded the version of the API that you are using. (See this in the SDK Manager)
  2. Look into your /res folder. Scan for every file. Does any one has problems? If one resource has a problem, the R.java file is not generated.
  3. Check the AndroidManifest.xml file. Look for warnings or problems, especially the use of the <uses-sdk> tag.

If none of these appointed the problem, try to build a simple java application. Does it work? Are you using the JDK 1.6?

Finally, if you are still stuck, download the Android ADT and use it as your IDE. It has all you need.

Renato Lochetti
  • 4,558
  • 3
  • 32
  • 49
  • This happens even for automatically created, "Hello world!" new android application projects. – Jakob Weisblat Jul 12 '13 at 01:47
  • Install one JDK 1.6 and try again, please. – Renato Lochetti Jul 12 '13 at 01:55
  • I guess I have both JDKs installed. – Jakob Weisblat Jul 12 '13 at 02:01
  • @JakobWeisblat - Sounds like it's time to dial in your development environment a bit ;-) To answer my own question: looks like you can use Java 7 while writing code for Android, but the actual devices will only be running Java 6 (so you can't use any of the new stuff from Java 7). – jahroy Jul 12 '13 at 02:05
  • I have Java 7 installed for Java programming. I don't use any of the new features anyway. – Jakob Weisblat Jul 12 '13 at 02:07
  • Um.... Are you serious? Does it really seem trivial to you to just _throw together_ a JVM implementation? Oh yeah... Throw in the fact that you have to get it optimized to run on all kinds of low performance phones. Actually Android code doesn't even run in a JVM, so it's even more complicated. There's some discussion of [Android and Java here](http://stackoverflow.com/q/3560963/778118). – jahroy Jul 12 '13 at 02:14
  • Yes, but that has nothing t do with what Google would have to do to run compiled code from Java 7 on a mobile device. Check out that question I just linked to... – jahroy Jul 12 '13 at 02:19
0

If your O/S is 64-bit Linux you will encounter Problems with the ADT because it is a 32-bit application. You have to install the following 32-bit libraries:

sudo apt-get install ia32-libs
Daniel Lerps
  • 5,256
  • 3
  • 23
  • 33