티스토리 뷰

반응형


 


unexpected namespace prefix "app" found for tag 


Unexpected namespace prefix "app" found for tag TextView less... (Ctrl+F1) 

Most Android views have attributes in the Android namespace. 

When referencing these attributes you must include the namespace prefix, 

or your attribute will be interpreted by aapt as just a custom attribute.  

Similarly, in manifest files, nearly all attributes should be in the android: namespace.





   에러 내용


Android Studio 에서 Typekit의 AddCustom1 을 xml Layout TextView에 적용할때 

app:font="cutom1"에  unexpected namespace prefix "app" found for tag 의 빨간 메시지를 볼 수 있다.


1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    
    <TextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:font="custom1" />
</LinearLayout>
cs





   해결


하지만 정상적으로 빌드가 되고 Font도 정상적으로 바뀌어 나오는 것을 볼 수 있다.


그래서 아래의 내용을 추가하여


xmlns:tools="http://schemas.android.com/tools" tools:ignore="missingPrefix"  


에러 메세지를 무시하도록 한다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:ignore="missingPrefix">
    
    <TextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:font="custom1" />
</LinearLayout>


반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함