R无法解析-Android错误

人盡茶涼 提交于 2020-07-28 03:35:45

问题:

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://stackoom.com/question/3iEL/R无法解析-Android错误
参考二: https://oldbug.net/q/3iEL/R-cannot-be-resolved-Android-error
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!