First time R.java itself is not generated

I tried everything I could to create the R.java file, but in vain. I just created an android project and, creating an android project, it does not create the R.java file! My project had compilation errors, because I still had to add the android.jar file to my project, but even after adding the jar file, clearing the existing assembly and rebuilding it did not work.

Then I checked the build automatically option in eclipse. Even that didn’t help!

A little should be noted:

1) I created an android project with support for android 2.2 and API version 8.

2) I would like to say that when creating the project he gives an error stating that proguard.cfg was not found! I could not find the default.properties file to delete the entry related to the proguard.cfg entry.

3) JAVA_HOME in my environment variables points to jdk1.4. I don’t know if this should be the reason!

4) Content

1.main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >
    <TextView  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="@string/hello"
    />
    </LinearLayout>

2.strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello World, HelloAndroidActivity!</string>
    <string name="app_name">Hello, Android !!</string>
</resources>

3.AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.pack.android.test"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".HelloAndroidActivity"
              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>

4.Code for HelloWorldActivity.java

  package com.pack.android.test;

  import android.app.Activity;
  import android.os.Bundle;

  public class HelloAndroidActivity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
      }
   }

Attached images for

Folder structure in eclipse (Eclipse 3.6)res / drawable-hdpi / icon.pngres / drawable-ldpi / icon.pngres / drawable-mdpi / icon.png Please help me. I just started with the Hello World app :)

Thanks Adithya

+5
source share
3 answers

R.java cannot be generated because you have other errors in non -related code associated with the R. file. So check if you have these errors, fix them and clean the project.

+2
source

Make sure you also update the SDK. Get platform tools and build tools 22.

+1
source

Eclipse

0

All Articles