android – Calligraphy library by chrisjenx is not working-ThrowExceptions

Exception or error:

I did what his documentation has instructed upon setting up the default font:

 protected void onCreate(Bundle savedInstanceState) {



  public void setupDefaultFont() {
        CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()

I also placed the fonts in assets/fonts, but to no avail.
Roboto still shows up as default font and not Open Sans. I tried applying it manually one by one to each TextView, but still it doesn’t work.

Any ideas on why this doesn’t work?

More info: (In case it is useful)
My miniSdkVersion is 15 and targetSdkVersion is 22.
These are my dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ''
    compile ''
    compile ''
    compile ''
    compile 'de.hdodenhof:circleimageview:1.2.1'
    compile ''

And this is the custom theme that I am using.

    <style name="myIIT_theme" parent="Theme.AppCompat">
        <item name="colorPrimaryDark">@color/primary_dark</item>
        <item name="colorPrimary">@color/primary</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:windowBackground">@color/tertiary_dark</item>
        <item name="android:activatedBackgroundIndicator">@drawable/selected_drawer</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
How to solve:

For the configuration to take effect, you should set up the default font in the onCreate() method of your custom application class, instead of in the activity.

Also, the instructions at say to inject into the context, by overriding a method in the activity as follows:

protected void attachBaseContext(Context newBase) {


Along with @Theo’s answer, make sure you register your custom Application in the Manifest

  android:name=".MyApplication" <----------- HERE


as mentioned in the Readme file in github,
This version of Calligraphy has reached its end-of-life and is no longer maintained. Please migrate to Calligraphy 3!

Leave a Reply

Your email address will not be published. Required fields are marked *