user1918149
user1918149

Reputation: 11

R.java not generated for android

I am using eclipse and the R.java file is not being generated. I understand from other discussions that this may be a problem due to an incorrect layout content. Here is my layout file generated by the SDK. I am not sure what the error is.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/first_android_app" />

</RelativeLayout>

Upvotes: 1

Views: 995

Answers (5)

Burhan ARAS
Burhan ARAS

Reputation: 2517

Here is your solution:

Open a terminal window and type

sudo apt-get install ia32-libs

even if you are using a 64-bit os, this will again help you. It worked perfectly for me.

Upvotes: 0

Khurram W. Malik
Khurram W. Malik

Reputation: 2895

Reasons for missing R.java could be

  • When you dont properly name your drawables
  • When there is some issue with your layouts
  • When you forget to register things (Activity etc) in AndroidManifest file
  • When there is a conflict in package name in manifest and some other place
  • Sometimes multiple pacakges can arise this issue

Tip: Look at the error in the console and see where does it refer !!

Fact: Cleaning the project does not solve the problem always

Upvotes: 0

Ashish Mishra
Ashish Mishra

Reputation: 167

Please see your resource file there will be some error in your XML file or name of images in capital latter .once its fix then clean the project and run.

Upvotes: 1

Aerial
Aerial

Reputation: 1185

I don't see any mistakes here, try to clean and restart Eclipse. It could also be that you have imported files with capital letters or any other characters that are not supported. Please be more clear because this is not going to help you out. What else did you do before this problem occured? What is the error message you see?

Upvotes: 0

GedankenNebel
GedankenNebel

Reputation: 2587

Try clean and build or use IntelliJ IDEA for Android developing :)

Upvotes: 0

Related Questions