在android编程中出现R cannot be resolved to a variable,怎么办? 如图1: 解决方法:删除activity代码页面顶部中的 import android.R,然后导入正确的包。 如图2: 效果图: