Android 보기에서 자주 발생하는 문제, XML 구문 분석 오류: 바인딩되지 않은 접두사
뷰에 .Error parsing XML: unbound prefix on Line 2
.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:id="@+id/myScrollLayout"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:layout_height="wrap_content" android:layout_width="fill_parent"
android:text="Family" android:id="@+id/Family"
android:textSize="16px" android:padding="5px"
android:textStyle="bold" android:gravity="center_horizontal">
</TextView>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:scrollbars="vertical">
<LinearLayout android:orientation="vertical" android:id="@+id/myMainLayout"
android:layout_width="fill_parent" android:layout_height="wrap_content">
</LinearLayout>
</ScrollView>
</LinearLayout>
이러한 현상이 발생할 수 있는 몇 가지 이유:
잘못된 네임스페이스 또는 특성에 오타가 있는 경우 이 오류가 표시됩니다.''xmlns', 'xmlns', 'xmlns'가 .xmlns:android
첫 번째 노드는 다음을 포함해야 합니다.xmlns:android="http://schemas.android.com/apk/res/android"
AdMob을 AdMob과 같은 사용자 합니다.ads:adSize
니가 필요한
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
사중인경우를 .LinearLayout
도구를 정의해야 할 수도 있습니다.
xmlns:tools="http://schemas.android.com/tools"
여기에 보이지 않는다고 해서 별도의 답변을 추가하려고 합니다.펜티엄10이 요구한 것이 100%는 아니지만, 저는 검색을 통해 여기에 오게 되었습니다.Error parsing XML: unbound prefix
는 애드모브 . 예를 들어, 광고의 커스텀 파라미터를 사용하고 .ads:adSize
하지만 나는 추가하지 않았습니다.
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
배치도까지.한 번 추가하면 효과가 좋습니다.
저도 같은 문제가 있었습니다.
[:[▁is의 있습니다.[whatever])의 철자가 정확하고 정확합니다.이 의경우인 xmlns:android="http://schemas.android.com/apk/res/android"
하세요.xmlns:android
철자가 정확한지 확인합니다.다른 접두사도 마찬가지입니다. 맞춤법이 올바른지 확인하고 다음을 수행해야 합니다.android:[name]
이것이 제 문제를 해결한 것입니다.
언급한 대로 올바른 네임스페이스를 지정해야 합니다.잘못된 네임스페이스에도 이 오류가 표시됩니다.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip">
작동하지 않습니다.
변경:
xmlns="http://schemas.android.com/apk/res/android"
로.
xmlns:android="http://schemas.android.com/apk/res/android"
는 "시작하는 것을 . 은 "":"가입니다.
android:
네임스페이스는 입니다.
xmlns:android
정의합니다.
이 오류는 다음과 같은 정의되지 않은 접두사를 사용하는 경우에 발생할 수 있습니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabHost
XYZ:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</TabHost>
안드로이드 컴파일러는 아직 XYZ가 정의되지 않았기 때문에 XYZ가 무엇인지 모릅니다.
이 경우 아래 정의를 xml 파일의 루트 노드에 추가해야 합니다.
xmlns:android="http://schemas.android.com/apk/res/android"
ViewPager 표시기에 대한 바인딩되지 않은 접두사 오류:
parentLayout에 있는 다음 헤더 태그와 함께:
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
추가:
xmlns:app="http://schemas.android.com/apk/res-auto"
이것은 저에게 효과가 있었습니다.
저의 경우, 첫 번째 줄에 "unbound prefix" 오류가 발생했지만, 네 번째 줄에 안드로이드의 철자를 잘못 썼습니다.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
anrdoid:fillViewport="true"
>
저도 같은 문제가 있었고, 첫 번째 노드에 Android:tools를 추가하는 것이 해결책이라는 것을 알게 되었습니다.내 경우에는 라인 레이아웃입니다.
<LinearLayout 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:orientation="vertical">
새로 온 사람들과 저처럼 XML을 이해하지 못하는 사람들을 위해 조금 더 노력하겠습니다.
위의 답변은 꽤 괜찮지만 일반적인 답변은 config.xml 파일에 사용되는 네임스페이스에 대한 네임스페이스가 필요하다는 것입니다.
번역:를 포함하는 XML 태그 이름은 네임스페이스가 있는 태그입니다. 여기서 blah는 네임스페이스이고 fubar는 XML 태그입니다.네임스페이스를 사용하면 다양한 도구를 사용하여 고유한 태그 이름으로 XML을 해석할 수 있습니다.예를 들어 Intel XDK는 intelxdk라는 네임스페이스를 사용하고 Android는 Android를 사용합니다.따라서 다음과 같은 네임스페이스가 필요하거나 빌드가 다음과 같이 변환됩니다(예: XML 구문 분석 오류: 바인딩되지 않은 접두사). 네임스페이스를 사용했지만 정의하지 않았습니다.
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:intelxdk="http://xdk.intel.com/ns/v1"
여기에는 많은 해결책이 있지만 실제로 문제의 근본 원인을 설명하지는 못하므로 다음과 같이 설명합니다.
속을 볼때와 같은 볼 때android:layout_width="match_parent"
그자리의 android
이고, 은 part 접사이고는, 여속성형다같음습다니과입니다.PREFIX:NAME="VALUE"
입니다. XML과 은 같지만 가 다른 두 개의 수 예를 들어 다음과 같이 이름은 같지만 접두사는 다른 두 개의 고유 속성을 가질 수 있습니다.a:a="val"
그리고.b:a="val"
.
▁prefix니와 같은 접두사를 합니다.android
또는app
를 사용하여 .xmlns
기여하다.
이 를 찾기만 하면 .tools:...
는 몇 이 제시된 .app:...
해야 할 은 다음과 .xmlns:app="http://schemas.android.com/apk/res-auto"
요소로
자세한 내용:
으로 이오는일다포않발경다니생을 포함하지 않은 합니다.xmlns:mm
일반적으로 코드의 첫 번째 줄에서 발생합니다.
나에게 그것은..
xmlns:mm="http://millennialmedia.com/android/schema "
코드의 첫 줄에서 내가 놓친 것.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mm="http://millennialmedia.com/android/schema"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="50dp"
android:layout_marginBottom="50dp"
android:background="@android:color/transparent" >
루트 태그에 적절한 이름 공간을 추가하기만 하면 됩니다. xmlns:sl="http://schemas.android.com/apk/res/android " Android 요소는 이 이름 공간에 선언됩니다.클래스 또는 패키지를 가져오는 것과 동일합니다.
저의 경우 위의 xml 네임스페이스 문제로 인해 오류가 발생하지 않았습니다.대신에 그것은 그 장소였습니다.android:id
속성 - 특정 요소의 선언에서 첫 번째 항목이어야 합니다.
그래서 이것은:
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/bottomtext"
android:singleLine="true" />
다음과 같이 읽어야 합니다.
<TextView android:id="@+id/bottomtext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
이 모든 것 외에도 이런 오류가 발생하는 시나리오도 있습니다.
사용자 또는 라이브러리 프로젝트에서 사용자 지정 특성 inttr.xml을 정의할 때 네임스페이스를 정의하지 않고 레이아웃 파일에서 이러한 특성을 사용합니다.
일반적으로 레이아웃 파일의 헤더에 이 네임스페이스 정의를 사용합니다.
xmlns:android="http://schemas.android.com/apk/res/android"
그런 다음 파일의 모든 속성이 다음으로 시작해야 합니다.
android:ATTRIBUTE-NAME
속성 중 일부가 Android:Attribute-NAME과 같은 다른 것으로 시작하지 않는지 확인해야 합니다.
temp:ATTRIBUTE-NAME
이 경우 일반적으로 다음을 포함하여 네임스페이스로도 이 "템프"를 사용할 수 있습니다.
xmlns:temp="http://schemas.android.com/apk/res-auto"
안드로이드의 철자를 틀렸을 때 주로 발생합니다. 저는 그냥 입력하거나 안드로이드나 그와 유사한 것들을 사용합니다. 특히 많은 시간 동안 프로그래밍을 한 후에 첫눈에 분명하지 않기 때문에 "안드로이드"를 하나씩 검색하고 검색이 한 태그를 건너뛸지 확인합니다. 그러면 자세히 보고 오타가 어디에 있었는지 알 수 있습니다.
제가 사용할 때 사마린에서 이 오류가 발생했습니다.
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="5dp"
card_view:cardUseCompatPadding="true">
</android.support.v7.widget.CardView>
Android용 너겟 패키지를 설치하지 않고 레이아웃 파일에 있습니다.support.v7.vmdk입니다.카드 보기
적용 가능한 너트 패키지를 설치하여 문제를 해결했습니다.도움이 되길 바랍니다, 이 대답을 목록 어디에서도 보지 못했습니다.
언급URL : https://stackoverflow.com/questions/2221221/frequent-issues-arising-in-android-view-error-parsing-xml-unbound-prefix
'code' 카테고리의 다른 글
Json.net 을 사용하여 JSON 개체를 동적 개체로 역직렬화 (0) | 2023.05.28 |
---|---|
왜 저는 캐치 없이 시도만 하거나 마지막으로 글을 쓸 수 없습니까? (0) | 2023.05.28 |
postgresql에서 쿼리를 중지/제거하는 방법은 무엇입니까? (0) | 2023.05.28 |
특정 테이블 및 항목에 대한 데이터베이스 덤프 만들기 Postgres (0) | 2023.05.28 |
C#은 VB.NET의 DirectCast에 해당합니다. (0) | 2023.05.28 |