Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid resource directory name "font" Xamarin Android

I just upgraded Visual Studio for mac to support Android 8 / api 26. I updated the AppCompat library to 26.1 to use the new font folder in the Resources directory of my Android project. Now when I try to compile I get "Invalid resource directory name" for path "obj/Debug/res/font" APT0000.

Error message

Resources folder

Xamarin android version

like image 524
BrunoVT Avatar asked Nov 22 '17 13:11

BrunoVT


2 Answers

For me the solution was to remove all the old Android SDK Build Tools from the SDK Manager. Now I only have for api level 26 and 27 installed and it works.

enter image description here

like image 129
BrunoVT Avatar answered Dec 03 '22 06:12

BrunoVT


First always check out the latest xamarin documentation about new features. https://developer.xamarin.com/guides/android/platform_features/introduction-to-oreo/

I quickly created a new xamarin android project and added two textviews with diffrent fonts:

Test App

My solution looks as the following:

Solution

I usually try to avoid capital letters in resource names as the android studio complains about it.

Main Layout:

<?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>

I think that you do not use the latest platform to build. Check that you use the latest platform (Oreo) to build the application.

like image 35
eugstman Avatar answered Dec 03 '22 06:12

eugstman