java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_773e439/Offline;
<p>I have an android application which depends on some android libraries I have built on my own. 
If I build the application with the library dependencies specified in the build.gradle then I get the following exception. </p>

<pre><code>-6694/com.mycompany.myproject D/AndroidRuntime: Shutting down VM
05-10 18:47:55.986 6694-6694/com.mycompany.myproject E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: com.mycompany.myproject, PID: 6694
                                                                        java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_773e439/Offline;
                                                                            at com.mycompany.ui.components.ListArrayAdapter.$jacocoInit(ListArrayAdapter.java)
                                                                            at com.mycompany.ui.components.ListArrayAdapter.&lt;init&gt;(ListArrayAdapter.java)
                                                                            at com.mycompany.myproject.NationalityFragment.onCreateView(NationalityFragment.java:47)
                                                                            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
                                                                            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
                                                                            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
                                                                            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
                                                                            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
                                                                            at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
                                                                            at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:602)
                                                                            at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)
                                                                            at android.app.Activity.performStart(Activity.java:5953)
                                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
                                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
                                                                            at android.app.ActivityThread.access$800(ActivityThread.java:144)
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                            at android.os.Looper.loop(Looper.java:135)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5221)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at java.lang.reflect.Method.invoke(Method.java:372)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
</code></pre>

<p>If I remove the dependencies and instead copy the concerned classes from the libraries and run the application, it runs perfectly fine. 
Also I have other dependencies like junit and app-compat and those don't seem to cause this issue. Any ideas what might be causing this issue? </p>

<ul>
<li>I have tried specifying the jacoco plugin to the following version
and it still doesn't seem to work.  </li>
<li>I have tried removing jacoco dependencies from the libraries : no
effect.</li>
</ul>

<p>My main build.gradle looks like this : </p>

<pre><code>    task wrapper(type: Wrapper) {
    gradleVersion = '2.13'
}

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
    }
}

subprojects {
    project.ext.set('compileSdkVersion', 23)
    project.ext.set('buildToolsVersion', '23.0.3')

    project.ext.set('minSdkVersion', 19)
    project.ext.set('targetSdkVersion', 23)
    project.ext.set('versionCode', 1)
    project.ext.set('versionName', '1.0-SNAPSHOT')

    project.ext.set('javaVersion', JavaVersion.VERSION_1_7)

    group 'com.mycompany.myproject'
    version = project.ext.get('versionName')

    repositories {
        mavenLocal()
        mavenCentral()
    }
}
</code></pre>