0

I am a beginner to android development and at the very first step I am having problems in generating R.java.I tried all the possible solutions to generate R.java still haven't been successful.I tried removing android.R import as well as checked all the XMLs for the case and still haven't found any strong reason for its suicide.My directory structure is as follows:

enter image description here

The thing is even if i create a new project it is created with the R errors and the new project is not equipped with R.java

My activity_mail.xml file is as follows

<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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</RelativeLayout>

My AndroidManfiest.xml file is

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.autorespond"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.autorespond.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

All the xml files are the default files without any changes.

log N
  • 925
  • 9
  • 33

3 Answers3

1

R.Java file is not generated when you have errors in XML try to solve them first then it will be generated.

If it doesn't try restarting eclipse.

If this is the case with even the new projects that you create. Then you should double check whether the Build Automatically option in the Project menu is checked. If its not checked then check it.

Sheraz Ahmad Khilji
  • 8,300
  • 9
  • 52
  • 84
0

It will generate automatically, Just go to Project menu in eclipse and select clean option from it. then again from Project menu select Build your project, or press Ctrl+B. It will build your project. and you can get rid of this error.

vahid abdi
  • 9,636
  • 4
  • 29
  • 35
InnocentKiller
  • 5,234
  • 7
  • 36
  • 84
0

This stackoverflow question should answer your question.

Developing for Android in Eclipse: R.java not regenerating

Check build automatically feature. Check if you have Uppercase letter or spaces in any file in res folder. If everything is fine then it should not give such errors.

Can you post your XML file ? I can have a look.

Community
  • 1
  • 1
1011
  • 121
  • 1
  • 15