Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font in XML with Android O

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: Error: The file name must end with .xml

like image 732
Akshaykumar Singh Avatar asked Jun 15 '17 07:06

Akshaykumar Singh


People also ask

What font type does Android use?

Font Formats Android O supports both . otf (OpenType) and . ttf (TrueType) font formats. I'm going to create a simple page design.

Can we use OTF fonts in Android?

That includes changing fonts. To change font styles in GO Launcher, copy the TTF or OTF font files on your phone. Long press on the home screen and select GO Settings > Font > Select Font. Pick the font you want or tap Scan to add files stored on your device.


1 Answers

I also got the similar issue. To fix that i followed the below steps.

  1. Updated Android Studio to latest canary build.
  2. Change distributionUrl in project-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

  3. Then update 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
}
  1. Sync, Clean and update the project.

It worked for me. Let me know with your comments.

like image 194
Mahendran Sakkarai Avatar answered Sep 29 '22 05:09

Mahendran Sakkarai