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