Calligraphy
Calligraphy copied to clipboard
NoClassDefFoundError: uk.co.chrisjenx.calligraphy.CalligraphyConfig$Builder
Getting java.lang.NoClassDefFoundError: uk.co.chrisjenx.calligraphy.CalligraphyConfig$Builder when running my app on android 4.4.4, on above android 5.0 its running fine.
tried all the solution i found.
app build.gradle
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
.
.
minSdkVersion 16
targetSdkVersion 22
jackOptions {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
multiDexEnabled true
}
}
dependencies {
.
.
compile 'com.android.support:multidex:1.0.1'
.
.
}
my custom application class extending MultiDexApplication
public class App extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
.
.
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath(Constants.FONT_REGULAR)
.setFontAttrId(R.attr.fontPath)
.build());
.
.
}
}
project build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
found the solution, the error was due to jack compiler adding these lines fixed it.
defaultConfig {
.
.
jackOptions {
enabled true
jackInProcess true
additionalParameters("jack.dex.output.policy" : "multidex")
additionalParameters("jack.preprocessor.file" : "legacyMultidexInstallation.jpp")
additionalParameters("jack.preprocessor" : "true")
additionalParameters("jack.dex.output.multidex.legacy": "true")
}
.
.
}
download legacyMultidexInstallation.jpp from here and put it into your project root folder(not in app folder).
Having the same problem, the solution proposed by nishantpardamwar is incompatible with data binding library.
Finally solved the problem extending application class from MultiDexApplication
Also - don't use Jack - he's dead.
Solved the problem extending application class from MultiDexApplication
If you're using for more than Lolipop versions as well then you have to include the library compile 'com.android.support:multidex:1.0.1'