NoClassDefFoundError on Calligraphy library NoClassDefFoundError on Calligraphy library android android

NoClassDefFoundError on Calligraphy library


If you support API levels under 21, your Application class should extend MultiDexApplication from the support library.

class MyApplication extends MultiDexApplication

If you do not have a custom Application class, than you should add the MultiDexApplication class to your manifest directly

<application    android:name="android.support.multidex.MultiDexApplication"></application>

See https://developer.android.com/tools/building/multidex.html


If your application extends from Application then override attachBaseContext inside Application i.e

@Overrideprotected void attachBaseContext(Context base) {    super.attachBaseContext(base);    MultiDex.install(this);}

Also need to add dependency

compile 'com.android.support:multidex:1.0.1'


Goodlife is here again to the rescue .Add this line to ur java file that extends application.

 public void onCreate() {    super.onCreate();    mInstance = this;    //ADD MULTIDEX.INSTALL(THIS) SOLVED MY SIMILAR PROBLEM    MultiDex.install(this);    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()                    .setDefaultFontPath("fonts/Roboto-Regular.ttf")                    .setFontAttrId(R.attr.fontPath)                    .build()    );}