2
我是非常新的android開發,並且正在嘗試創建我的第一個進程,當我遇到構建錯誤與問題標題。Android:「錯誤解析XML:不能undeclare前綴」
這裏是我的XML代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app= ""
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
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="com.example.austinc.clicker.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:id="@+id/textViewCount"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textSize="24dp" />
<Button
android:text="Reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ButtonClick"
android:layout_alignLeft="@+id/ButtonClick"
android:layout_alignStart="@+id/ButtonClick"
android:layout_marginTop="61dp"
android:id="@+id/buttonReset" />
<Button
android:text="Click"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="55dp"
android:id="@+id/ButtonClick"
android:layout_below="@+id/textViewCount"
android:layout_centerHorizontal="true" />
</RelativeLayout>
從我可以通過雙擊該錯誤推斷,問題與代碼的第二行(其中的含義,我不知道)做。這是一個快速修復,還是我在編輯某段代碼時犯了一個錯誤?
不知道怎麼收場了這一點,但通常要'的xmlns :app =「http://schemas.android.com/apk/res-auto」'爲該行。或者,使用您當前的佈局,您可以將其刪除,因爲您沒有在任何地方使用該名稱空間。 –
@MikeM。非常感謝你;我無法真正發現任何與此錯誤有關的問題。這有助於解決問題。 – AustinC
這看起來像一個新問題,請參閱:https://code.google.com/p/android/issues/detail?id=223363 – thebenedict