java.lang.NoSuchMethodError: No static method getFont (android-ktx)

April 6, 2018

I bump into the following exception when including androidx.core:core-ktx:0.3 (android-ktx)

java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of ‘’ appears in /data/app/*-1/base.apk) at

I was using Android Support Library 26.1.0 with compileSdkVersion/targetSdkVersion 26

I found some Q&A to set buildToolsVersion "26.1.0", but I bump into the following error because I am using Android Gradle Plugin 3.1.0.

The specified Android SDK Build Tools version (26.1.0) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0. Android SDK Build Tools 27.0.3 will be used.

NOTE: if seems if you have upgraded to Android Studio 3.1 which require Android Gradle Plugin 3.1.0, the minumum supported buildToolsVersion is 27.0.3

It seems obvious the only solution is upgrade everything to 27 (perhaps it’s saner to keep support library, build tool and sdk version the same)

  • Android Support Library: 27.0.3
  • buildToolsVersion "27.0.3"
  • compileSdkVersion/targetSdkVersion 27

The above settings solve the NoSuchMethodError: No static method getFont exception.


This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.