必须声明Element font-family(Element font-family must be declared)

当我从github打开一个项目时,res文件夹中的文件夹有一个xml资源product_famliy.xml但是android studio有一个错误:

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>

when i open a project from github ,the folder from res folder has a xml resource product_famliy.xml but android studio has a 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>

最满意答案

我想你需要Android Studio 3.0

I guess you need Android Studio 3.0

更多推荐