我只是想在这里运行教程,具体来自http://developer.android.com/resources/tutorials/hello-world.html,特别是我们添加字符串资源的部分。我已经复制了代码,但是我得到了以下错误...
这是strings.xml文件。
我猜这是一些显而易见的东西,但我已经重新输入和复制了几次,并删除了字符串标签前面的空格,但错误仍然存在。
有任何想法吗?
编辑... 这是Java文件...
此外,“clean”没有起作用,但这是个好主意。
[2012-02-02 20:35:35 - HelloAndoird] /home/slabounty/workspace/HelloAndoird/res/values/strings.xml:2: error: Found text "
[2012-02-02 20:35:35 - HelloAndoird] /" where item tag is expected"
[2012-02-02 20:35:35 - HelloAndoird] /home/slabounty/workspace/HelloAndoird/res/layout/main.xml:3: error: Error parsing XML: not well-formed (invalid token)
这是strings.xml文件。
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello Android! I am a string resource!</string>
<string name="app_name">Hello, Android</string>
</resources>
如果需要访问main.xml,
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/hello"/>
我猜这是一些显而易见的东西,但我已经重新输入和复制了几次,并删除了字符串标签前面的空格,但错误仍然存在。
有任何想法吗?
编辑... 这是Java文件...
package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
public class HelloAndoirdActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
此外,“clean”没有起作用,但这是个好主意。