出现这种报错的原因可能是在添加资源文件时,系统自动添加了“import android.R;”,而android.R是系统提供的资源,因此该程序的资源就无法检索到,导致报错。

解决办法:删掉:import android.R;