Adding JsonPath in Android Studio causes non-zero exit value 2 error

When I add the JsonPath library to my Android Studio (1.4) project I get an error as following:

Error:Execution failed for task ':app:dexDebug'. \>
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command 'C:\Program Files\JDK_64_bit\bin\java.exe'' finished with 
non-zero exit value 2

(I added the library via File > Project Structure > Dependencies > Library Dependency > com.jayway.jsonpath:json-path:2.0.0)

Trying to add MultiDex support for the app as suggested in a few other questions results in a different error:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. \>
java.util.zip.ZipException: duplicate entry:
org/objectweb/asm/AnnotationVisitor.class

The external libraries in my project list both asm-1.0.2 and asm-3.3.1 but removing one or both does not solve my problem.

build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.example.REDACTED.REDACTED"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.jayway.jsonpath:json-path:2.0.0'
compile 'com.android.support:multidex:1.0.1'
}

app.iml (libraries):

    <orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="library" exported="" name="butterknife-7.0.1" level="project" />
    <orderEntry type="library" exported="" name="asm-3.3.1" level="project" />
    <orderEntry type="library" exported="" name="multidex-1.0.1" level="project" />
    <orderEntry type="library" exported="" name="json-path-2.0.0" level="project" />
    <orderEntry type="library" exported="" name="asm-1.0.2" level="project" />
    <orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
    <orderEntry type="library" exported="" name="slf4j-api-1.7.10" level="project" />
    <orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
    <orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
    <orderEntry type="library" exported="" name="json-smart-2.1.1" level="project" />

androidmanifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.REDACTED.REDACTED" >
    <uses-permission android:name="android.permission.INTERNET" />
    <application

        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Thank you very much in advance!

That usually means you have 2 different versions of the same library referenced somewhere

Have you tried putting:
multiDexEnabled = true

in your defaultConfig section?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.