刚刚开始为 android 开发,现在我在创建一个新项目时出现错误,上面写着R 无法解析为变量
- 我尝试重建
- 我尝试设置路径
- 我检查了 XML 和清单
- R.java 文件不存在
这是活动的java文件
package com.pingcampus.pc;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Startingpoint extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.startingpoint);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.startingpoint, menu);
return true;
}
}
这是应用程序的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pingcampus.pc"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.pingcampus.pc.Startingpoint"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
也有人要求..这也是XML(活动)代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".Startingpoint" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
控制台错误(重启 ECLIPSE 后)
[2013-06-20 19:06:12 - Pingcampus] 'default' is not a best match for any device/locale combination.
[2013-06-20 19:06:12 - Pingcampus] Displaying it with ', , Locale Language ___Region __, , sw320dp, w320dp, h533dp, Normal Screen, Long screen aspect ratio, Portrait Orientation, Normal, Day time, High Density, Finger-based touchscreen, Soft keyboard, No keyboard, Hidden navigation, No navigation, Screen resolution 800x480, API Level 17' which is compatible, but will actually be displayed with another more specific version of the layout.
帮助!
这是窗口的屏幕截图