问题:
I just downloaded and installed the new Android SDK.我刚刚下载并安装了新的 Android SDK。 I wanted to create a simple application to test drive it.我想创建一个简单的应用程序来测试驱动它。
The wizard created this code:向导创建了以下代码:
package eu.mauriziopz.gps;
import android.app.Activity;
import android.os.Bundle;
public class ggps extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
but Eclipse gives me the error但Eclipse给了我错误
R cannot be resolved R无法解析
on line在线的
setContentView(R.layout.main);
Why?为什么?
PS: I do have an XML file named main.xml
under res/layout/
. PS:我在res/layout/
下确实有一个名为main.xml
的 XML 文件。
解决方案:
参考一: https://en.stackoom.com/question/3iEL参考二: https://stackoom.com/question/3iEL