我的ADT是0.9.6的 android的SDK是2.2的 JDK在1.5和1.6下都出现这个问题。度娘和谷歌搜索出来的一些方法解决不了次问题,望高手指教。
PS: R.JAVA文件存在.
代码如下:package H1.H1;import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;public class H1 extends Activity  
{
private EditText getNameEditText;
private Button button_Login;
private TextView show_Login_TextView;/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)  
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);getNameEditText=(EditText)findViewById(R.id.widget29_getName_EditText);//错误就出现在R.idbutton_Login=(Button)findViewById(R.id.widget30_Login_Button);//错误同上show_Login_TextView=(TextView)findViewById(R.id.widget31_showLogin_TextView);//错误同上button_Login.setOnClickListener
(new OnClickListener()
{
@Overridepublic void onClick(View v){
//TODO Auto-generated method stub
show_Login_TextView.setText(getNameEditText.getText()+"111");
}
});
}
}

解决方案 »

  1.   

    <?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.   

    1.把所有java代码复制再重新粘贴~
    2.make clean
    试试
      

  3.   

    java代码是拷贝过来的吧?
    xml文件都没有写好当然有问题啊,你看看别人的xml文件,R相关的东西是自动生成的。
      

  4.   

    你的xml文件里面压根都没给控件定义ID,在程序里面能不报错嘛。
    <?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:id="@+id/你定义的ID"
      android:layout_width="fill_parent"  
      android:layout_height="wrap_content"  
      android:text="@string/hello"
      />
    </LinearLayout>
      

  5.   


    分别要把:
    getNameEditText、button_Login、show_Login_TextView 这三个都定义下 是不?
      

  6.   

    就根据你的java文件修改你的main.xml吧
    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"
      >
    <EditText   
      android:id="@+id/widget29_getName_EditText"
      android:layout_width="fill_parent"   
      android:layout_height="wrap_content"   
      />
    <Button   
      android:id="@+id/widget30_Login_Button"
      android:layout_width="fill_parent"   
      android:layout_height="wrap_content"   
      />
    <TextView   
      android:id="@+id/widget31_showLogin_TextView"  android:layout_width="fill_parent"   
      android:layout_height="wrap_content"   
      android:text="@string/hello"
      />
    </LinearLayout>红色部分要好好琢磨下。。