0

I'm just starting to develop with android, and a followed a tutorial on google to get everything set up. I'm using eclipse and I have both the android sdk and the eclipse plugin installed, but when I create a new Android Project, I get an error on this line from the start.

my code :-

package khalid.app.fm;

import android.app.Activity;
import android.os.Bundle;
import android.R.*;

public class RadioBlancoFMActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
4

4 回答 4

4

remove

import android.R.*;

Don't import android.R.

于 2013-04-19T20:26:02.400 回答
1

检查 AndroidManifest 是否引用了 khalid.app.fm 包。

于 2013-04-19T20:36:47.470 回答
1

正如@wtsang02 所说,不要导入android.R. 我想补充一点,android.R这与使用R.idor时不同R.layoutandroid.R正在引用内置于 Android 资源本身的资源。R引用您为应用程序设计的资源。

于 2013-04-19T20:30:40.483 回答
0

确保project -> build automatically处于活动状态

于 2013-04-19T20:42:17.773 回答