0

编码:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:weightSum="1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

   <EditText android:id="@+id/edit_message"
        android:layout_weight = "1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message" />
   <Button
        android:id="@+id/bSend"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_send" />
</LinearLayout>

错误信息:

BUILD FAILED
C:\My First App\res\layout\activity_main.xml:7: Unexpected element "{}LinearLayout" {antlib:org.apache.tools.ant}LinearLayout

该代码几乎与 Android 网站上的代码完全相同,而且我似乎无法让它工作,这真的很令人沮丧。是代码中的问题,还是在我这边?我正在使用 Eclipse

4

1 回答 1

1

我遇到了同样的错误。我在 Ubuntu 12.04 中使用 Indigo,无论我使用什么库或 Eclipse 插件,它总是在那里。

对我有用的是重新下载并重新安装 Android SDK(在您的情况下可能不需要),并从 Eclipse 网站下载 Eclipse Classic (Juno),而不是使用存储库中的 Indigo 包。课上说无论如何都推荐Classic,所以无论如何,我很高兴它现在可以工作。

如果您使用的是 Windows,我仍然建议您下载最新的 Classic 版本,否则我无法提供帮助。

于 2012-09-05T03:55:33.417 回答