NoClassDefFoundError when add Twitter Fabric SDK


#1

WHEN i add Twitter to my grade file , my apps crach
mesg :

NoClassDefFoundError

grade file

buildscript {
repositories {
jcenter()
mavenCentral()
maven { url ‘https://maven.fabric.io/public’ }
}

dependencies {

    classpath 'com.android.tools.build:gradle:1.3.0'
    classpath 'io.fabric.tools:gradle:1.+'
}

}
apply plugin: 'com.android.application’
apply plugin: ‘io.fabric’

android {
compileSdkVersion 22
buildToolsVersion '22.0.1’
packagingOptions {
exclude 'META-INF/LICENSE’
exclude 'META-INF/LICENSE.txt’
exclude 'META-INF/license.txt’
exclude 'META-INF/NOTICE’
exclude 'META-INF/NOTICE.txt’
exclude 'META-INF/notice.txt’
exclude ‘META-INF/ASL2.0’
}
defaultConfig {
applicationId "com.newanoir.azmen"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName “1.0”
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’,‘proguard-com.twitter.sdk.android.twitter.txt’
}
}

}

repositories {

mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public' }

}
dependencies {
compile fileTree(dir: ‘libs’, include: [’*.jar’])
compile 'com.android.support:support-v13:22.0.0’
compile 'com.android.support:support-v4:22.0.0’
compile 'joda-time:joda-time:2.8.2’
compile 'com.afollestad:material-dialogs:0.7.6.0’
compile files(‘libs/httpmime.jar’)
compile 'com.loopj.android:android-async-http:1.4.8’
compile 'com.google.android.gms:play-services:7.8.0’
compile 'com.wdullaer:materialdatetimepicker:1.4.2’
compile(‘com.twitter.sdk.android:twitter:1.8.0@aar’) {
transitive = true;
}
}


#2

Hey there,

Can you please include the full error message including which classes are not being found?

Thanks,
Mike


#3

LG Device, Android version 4.4.4

java.lang.NoClassDefFoundError: com.crashlytics.android.answers.Answers
at com.crashlytics.android.Crashlytics.(Crashlytics.java:29)
at br.com.insoccer.core.CoreApplication.onCreate(CoreApplication.java:67)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4473)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)

-------------- FIXED

These two lines were reversed
1 - Fabric.with(this, new Crashlytics());
2 - MultiDex.install(this);

this worked for me
1 - MultiDex.install(this);
2 - Fabric.with(this, new Crashlytics());


#4

thanks alot for your help


#5