問題:
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