Unexpected namespace prefix "xmlns" found for tag LinearLayout

エラーエラー

エラーメッセージ

 状態:解決済  閲覧数:5,619  投稿日:2013-05-29  更新日:2013-05-29
Unexpected namespace prefix "xmlns" found for tag LinearLayout
直訳
・LinearLayoutタグに予期せぬプレフィクス名前空間"xmlns"が見つかった


概要


・パーサが重複する名前空間宣言を拒否している


原因


・名前空間宣言が重複しているため


対策


・名前空間宣言を重複しないようにすれば良い

実際に遭遇したエラー例

 閲覧数:735 投稿日:2013-05-29 更新日:2013-05-29

修正前


・「xmlns:android="http://schemas.android.com/apk/res/android"」が重複している
▼レイアウトXML(res/layout/activity_main.xml)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:orientation="vertical"
   android:paddingTop="10dp"
   android:background="#a0a0a0"
   >
       <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           android:background="#a0a0a0">



修正後


・内側の「xmlns:android="http://schemas.android.com/apk/res/android"」を削除し重複回避
▼レイアウトXML(res/layout/activity_main.xml)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:orientation="vertical"
   android:paddingTop="10dp"
   android:background="#a0a0a0"
   >
       <LinearLayout
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           android:background="#a0a0a0">



この行に複数マーカーがあります

Context を変数に解決できません



週間人気ページランキング / 3-10 → 3-16
順位 ページタイトル抜粋 アクセス数
1 この行に複数マーカーがあります | エラー(エラー) 13
2 R.java was modified manually! Reverting to generated version! | エラー(エラー) 5
3 Android FAQ 4
4 The process android.process.acore has stopped unexpectedly. Please try again. | エラー(エラー) 3
4 E/AudioPlayer(★★): FAILED renaming /mnt/sdcard/tmprecording.3gp to /android_asset/●●.mp3 | エラー 3
5 型 ○○親クラス名.△△ネストクラス名 は継承された抽象メソッド AsyncTask<第1引数,第2引数,第3引数>.doInBackground(Object...) を実装する必要があります | エラー(エラー) 2
5 カテゴリ一覧 2
5 Project build error: Non-resolvable parent POM: Failure to find | エラー 2
5 ログイン 2
5 adb shell … error: device not found | Android Debug Bridge (adb) 2
5 Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties | エラー(エラー) 2
5 プラグイン "org.eclipse.ui.workbench" からのコードの起動で問題が発生しました | エラー(エラー) 2
5 public 型 ★★ はそれ独自のファイル内に定義されなければなりません | エラー 2
5 「SQLite Database 」へ保存したデータを確認したい | SQLite 2
5 アプリケーション起動時に表示されるアクティビティを変更 | 仕組み 2
5 Android Studio で、ソースコードが改行できない | Android Studio(IDE) 2
5 Failed to allocate memory: 8 | エラー(エラー) 2
6 Apache Maven(環境構築) カテゴリー 1
6 Error: Could not access the Package Manager. Is the system running? | 環境構築 1
6 java.lang.NullPointerException | エラー(エラー) 1
2026/3/17 5:05 更新