Android Studio中添加JsonPath导致非零退出值2错误 [英] Adding JsonPath in Android Studio causes non-zero exit value 2 error
问题描述
当我添加了 JsonPath 库到Android工作室(1.4)的项目,我得到错误如下:
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
(我通过文件>项目结构>依赖也会添加库>库的依赖> com.jayway.jsonpath:JSON路径:2.0.0 )
试图增加对应用程序MultiDex支持,在不同的错误几个其他问题结果表明:
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
在我的项目列表中的外部库都ASM-1.0.2和ASM-3.3.1,但去掉一个或两个没有解决我的问题。
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 (库):
<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!
推荐答案
在您的build.gradle文件中添加以下codeS:
in your build.gradle file add following codes :
defaultConfig {
multiDexEnabled true
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
dexOptions {
javaMaxHeapSize "4g"
}
这篇关于Android Studio中添加JsonPath导致非零退出值2错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!