2017-11-22 2 views
3

Android 8/api 26.을 지원하기 위해 Mac 용 Visual Studio를 업그레이드했습니다. Android 프로젝트의 Resources 디렉토리에서 새 글꼴 폴더를 사용하려면 AppCompat 라이브러리를 26.1로 업데이트했습니다. 이제 컴파일하려고 할 때 경로 "obj/Debug/res/font"APT0000에 대해 "잘못된 자원 디렉토리 이름"이 표시됩니다.잘못된 리소스 디렉토리 이름 "font"Xamarin Android

Resources folder

Xamarin android version

+0

어떻게 ? – MilanG

+0

@MilanG 원래 어떻게 했는가하지만 버전 26을 appcompat 한 이후로 자원으로 추가 할 수 있습니다. 이것이 내가 어떻게하고 싶은지입니다. https://developer.xamarin.com/guides/android/application_fundamentals/resources_in_android/part_7_-_fonts/#Fonts_as_a_Resource – BrunoVT

+0

'빌드 도구'가 컴파일 할 API 수준과 일치하는지 확인하십시오. 이 경우, Oreo를 목표로한다면'build-tools' 26 이상을 사용해야합니다. –

답변

1

먼저 항상 새로운 기능에 대한 최신 자 마린 문서를 체크 아웃

Error message

. https://developer.xamarin.com/guides/android/platform_features/introduction-to-oreo/

나는 빨리 새로운 자 마린 안드로이드 프로젝트를 생성 diffrent 글꼴이 textviews 추가 :

Solution

나는 보통 시도 : 내 솔루션은 다음과 같은 모양

Test App 안드로이드 스튜디오가 그것에 대해 불평하는 것처럼 리소스 이름에 대문자를 피하십시오.

홈페이지 레이아웃 :

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

    <TextView 
    android:text="Pacifico example text" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:fontFamily="@font/pacifico" /> 

    <TextView 
    android:text="Roboto light example text" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:fontFamily="@font/roboto_light" /> 

</LinearLayout> 

난 당신이 구축 최신 플랫폼을 사용하지 않는 것이 생각합니다. 최신 플랫폼 (Oreo)을 사용하여 애플리케이션을 빌드했는지 확인하십시오.

4

나를 위해 해결책은 SDK 관리자에서 모든 오래된 Android SDK 빌드 도구를 제거하는 것이 었습니다. 이제 저는 API 레벨 26과 27 만 설치하고 작동합니다. 자산/글꼴 디렉토리에 글꼴을 추가하는 방법에 대한

enter image description here

+0

나를 위해 일했고, 새로운 도구 버전을 추가 할 필요가 없었지만 모든 이전 버전을 삭제해야했습니다 (<26). – Huby

관련 문제