The element's font family must be declared

when i open the project from github the folder from res folder has xml resource product_famliy.xml but android studio has error:

Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
E:\googledownload\PaperPlane-master\app\src\main\res\font\product_family.xml
Error:Error: Unsupported type 'font'
Error:Execution failed for task ':app:mergeDebugResources'.
> E:\googledownload\PaperPlane-master\app\src\main\res\font\product_family.xml: Error: Unsupported type 'font'
Information:BUILD FAILED
Information:Total time: 21.311 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console 

      


<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <font
        android:fontStyle="normal"
        android:fontWeight="400"
        android:font="@font/product_sans_regular"
        app:fontStyle="normal"
        app:fontWeight="400"
        app:font="@font/product_sans_regular"/>

    <font
        android:fontStyle="italic"
        android:fontWeight="400"
        android:font="@font/product_sans_italic"
        app:fontStyle="italic"
        app:fontWeight="400"
        app:font="@font/product_sans_italic"/>

</font-family>

      

+3


source to share


2 answers


I think you need Android Studio 3.0



+4


source


This is a new feature in the new version of Android O (Android 26).
To make it work with fonts in XML, you need to install Android Studio 3.x and compile it with the latest version (26).



See more here: https://developer.android.com/preview/features/working-with-fonts.html

0


source







All Articles