[SOLVED!!] Help! R.java problem

+2 jan burg · November 8, 2014
Hey guys, I'm trying to get into android app development using android's eclipse, and I can't for the life of me get past this problem.

So I downloaded the sdk and all the needed packages through Android SDK Manager. I create a new empty android project, with which I've tried multiple target sdks. Then I go to src >> <package_name> >> MainActivity to compile, and I get the error "R cannot be resolved to a variable". I went and searched this problem on the internet. It turns out my R.java file is not being generated at gen >> <package_name> >> R.java. I've tried a bunch of suggestions to get it to generate, fixing imports and such, but it just won't generate after trying all sorts of things and cleaning the project. Has anybody else run into this problem and been able to fix it??? I'm using the latest ADT/ADK package you download from android's site. I really can't believe the absurdity of this problem, ridiculous. I might just have to try using Android Studio soon.

Any help much appreciated.

Post a Reply


Oldest  Newest  Rating
0 jan burg · November 13, 2014
Finally figured it out guys. :):):):):):):):):)

The problem is an x86 x64 related issue. My machine is x64 so I was missing a 32-bit library that was required. Specifically, on my machine I was missing the 32bit libz.so.1 in my system, so to fix it I went to the terminal and did:

sudo apt-get install lib32z1

To get other 32-bit libs you can do:

sudo apt-get install ia32-libs

The other thing I did was add an import in my main activity:

import <package name>.R;

where <package name> is the package that your main activity resides in.
0 Troy Jones · November 14, 2014
Wow, Eclipse wouldn't even load for me with it not being equal bit software.  I wonder how that happened to you?
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator