R 无法解析 - Android 错误 - R cannot be resolved - Android error

问题:

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 errorEclipse给了我错误

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章