带有Android O的XML中的字体 [英] Font in XML with Android O
问题描述
Android O给字体目录提供了新的android-studio版本3.0,但是当在字体目录中放下字体文件并运行项目时,它给我字体目录中的字体文件提供了错误. 错误:任务':app:mergeDebugResources'的执行失败.
Android O give font directory with new android-studio version 3.0 but when in drop font-file in font directory and run project it give me a error in font file in font directory. Error:Execution failed for task ':app:mergeDebugResources'.
/home/ttuser4/Downloads/fontPractice/app/src/main/res/font/Dancing_Script.ttf:错误:文件名必须以.xml结尾
/home/ttuser4/Downloads/fontPractice/app/src/main/res/font/Dancing_Script.ttf: Error: The file name must end with .xml
推荐答案
我也遇到了类似的问题.为了解决这个问题,我按照以下步骤操作.
I also got the similar issue. To fix that i followed the below steps.
- 将Android Studio更新为最新的Canary版本.
- 将
project-dir/gradle/gradle-wrapper.properties
中的distributionUrl
更改为最新的gradle分发URL(您可以从这里)来更新用于构建的gradle版本,如下所示.
- Updated Android Studio to latest canary build.
- Change
distributionUrl
inproject-dir/gradle/gradle-wrapper.properties
to latest gradle distribution url(You can get the latest availability of gradle from here) to update the gradle version used to build like below.
distributionUrl = https://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
build.gradle
中的com.android.tools.build:gradle
版本更新为最新版本,如下所示. (注意:下面提到的版本是发布答案时的最新版本.该版本将来可能会更改.请注意这一点.)
com.android.tools.build:gradle
version in the root build.gradle
to the latest like below. (Note: Below mentioned version is the latest one when the answer is posted. The version might be change in future. So take care about that.)
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
- 同步,清理和更新项目.
对我有用.让我知道你的评论.
It worked for me. Let me know with your comments.
这篇关于带有Android O的XML中的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!