当我从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>
答案 0 :(得分:4)
我猜你需要Android Studio 3.0
答案 1 :(得分:0)
这是新Android O版本(android 26)的新功能 要使用XML格式的字体,您需要安装Android Studio 3.x并使用最新版本进行编译(26)。
另请参阅此处:https://developer.android.com/preview/features/working-with-fonts.html