NoClassDefFoundError

NoClassDefFounderror on un-related classes when using depencies!

I am not sure if I am doing something wrong or got the wrong idea of gradle - I have been trying to use it with android studio. It works well, till I introduce a dependency and the it throws a “NoClassDefFoundError” on a totally different class that is not even related to the added dependency.

Here is an example - with JakeWharton/Android-ViewPagerIndicator

Download the project, imported the library into android studio. Builds well, compiles well - but crashes with an error when I try to deploy into onto a device. The error log is such…

01-12 14:06:26.173
21138-21138/com.mface.mcall E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NoClassDefFoundError: com.mface.mcall.utils.Consts
            at com.mface.mcall.utils.ImageUtils.getImageLoaderConfiguration(ImageUtils.java:60)
            at com.mface.mcall.App.initImageLoader(App.java:33)
            at com.mface.mcall.App.initApplication(App.java:43)
            at com.mface.mcall.App.onCreate(App.java:28)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1070)
            at com.lbe.security.service.core.client.b.x.callApplicationOnCreate(Unknown Source)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4708)
            at android.app.ActivityThread.access$1300(ActivityThread.java:173)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5469)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:857)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
            at dalvik.system.NativeStart.main(Native Method)

App’s build.grade is this…

repositories {
    jcenter()
}
buildscript {
    repositories {
        jcenter()
    }
  }
apply plugin: 'com.android.application'
repositories {
    jcenter()
}
dependencies {
    compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    //compile 'com.android.support:appcompat-v7:21.0.3'
    compile project(':jkviewpagermaster')
    compile 'com.android.support:support-v13:20.0.+'
    compile project(':Q-municate_core')
    compile "info.hoang8f:fbutton:${rootProject.FButtonVersion}"
    compile "com.google.android.gms:play-services:${rootProject.googlePlayServicesVersion}"
    compile "com.soundcloud.android:android-crop:${rootProject.cropperVersion}@aar"
    compile "com.nostra13.universalimageloader:universal-image-loader:${rootProject.universalImageLoaderVersion}"
      compile group: 'com.squareup.picasso', name: 'picasso', version: "${rootProject.picassoVersion}"
    compile "com.google.guava:guava:${rootProject.guavaVersion}"
    compile "com.makeramen:roundedimageview-apklib:${rootProject.roundedImageViewVersion}"
    compile "se.emilsjolander:stickylistheaders:${rootProject.stickyListHeadersVersion}"
    compile ('de.keyboardsurfer.android.widget:crouton:1.8.4@aar'){
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.easing:library:1.0.1@aar'
    compile 'com.daimajia.androidanimations:library:1.1.3@aar'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    compile 'me.drakeet.materialdialog:library:1.2.2'
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
//
  compile ('com.crashlytics.android:crashlytics:1.+'){
//
      exclude group: 'com.google.android', module: 'support-v4'
//
  }
  }
  android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
      defaultConfig {
        applicationId "com.mface.mcall"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable false
            signingConfig signingConfigs.debug
            zipAlignEnabled true
        }
      }
      dexOptions{
        // jumboMode = true
        preDexLibraries = false
        incremental true
        javaMaxHeapSize "4g"
    }
}

The build and run works perfectly fine if i remove compile project(’:jkviewpagermaster’). The same problem with crashlytics.

There are no helpful errors messages to know what’s going wrong since it only crashes during a run.

Any support is highly apprecitated