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.

9
  • try to clean and build project..,and delete it from workspace and import againg Commented Feb 25, 2014 at 7:48
  • goto project menu, clean your project. Commented Feb 25, 2014 at 7:49
  • 2
    maybe you have an error on xml file, check those if cleaning not worked for you Commented Feb 25, 2014 at 7:50
  • Most of the time console gives you the idea why R file is not generating... So read your console carefully Commented Feb 25, 2014 at 7:50
  • Clean your Project or select build automatically from Project Menu Commented Feb 25, 2014 at 7:50

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

7 Comments

I didn't find any mischief in my XML file and even eclipse is not pointing to any error on it.Restarting also didn't work for me.
@Nilesh Did u try restarting adb ?
Wait I will give it a try now.
It didn't work either.Yeah my build automatically is checked.Can there be some problem in the plugin?I just installed the android development tools from the market place and I pointed it to adt bundle.Is there something else I need to get from the marketplace?
No i don't think there is anything else you need other than the JDK and Android SDK. Have you tried creating new Android project in eclipse. Does it give the same error?
|
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.

Comments

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.

1 Comment

Tried this solution but didn't work for me.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.