第一次自己的R.java没有生成

Adi*_*hya 6 android

我已尽力生成R.java文件,但徒劳无功.我刚刚创建了一个android项目,在创建android项目时,它没有创建R.java文件!我的项目中存在编译错误,因为我仍然需要将android.jar文件添加到我的项目中,但即使添加了jar文件,清理现有构建并再次构建它也无法正常工作.

然后我在eclipse中检查了"自动构建"选项.即使这没有帮助!

很少有事情需要注意:

1)我用build-target android 2.2和API version 8创建了android项目.

2)我想告诉的是,在创建项目时,它给出了一个错误,说找不到proguard.cfg!我找不到'default.properties'文件来删除引用proguard.cfg条目的条目.

3)我的环境变量中的JAVA_HOME指向jdk1.4.不知道这不应该是这个原因!

4)内容

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>
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

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);
      }
   }
Run Code Online (Sandbox Code Playgroud)

随附图片

eclipse中的文件夹结构(Eclipse 3.6) RES /抽拉-HDPI /的icon.png RES /抽拉-LDPI /的icon.png RES /抽拉-MDPI /的icon.png 请帮帮我.我刚开始使用Hello World应用程序:)

谢谢,Adithya

nha*_*man 2

R.java 可能无法生成,因为您的代码中存在与 R 文件无关的其他错误。因此,请检查您是否有这些错误,修复它们并清理您的项目。