Java 在Android Studio中添加JsonPath会导致非零退出值2错误
当我将库添加到我的Android Studio(1.4)项目时,我得到一个错误,如下所示:Java 在Android Studio中添加JsonPath会导致非零退出值2错误,java,android,android-studio,jsonpath,Java,Android,Android Studio,Jsonpath,当我将库添加到我的Android Studio(1.4)项目时,我得到一个错误,如下所示: 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.ex
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支持会导致不同的错误:
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,但删除其中一个或两个并不能解决我的问题
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'
}
<?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>
app.iml(库):
androidmanifest.xml:
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'
}
<?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>
提前非常感谢 如果添加
编译'net.minidev:json smart:2.2'
,问题将得到解决
有关此问题的更多背景信息,请参阅和。尚未发布的
json path
版本2.1.0
将指向json smart
的2.2
版本,从而解决此问题。在此之前,必须使用上述解决方法。在build.gradle文件中添加以下代码:
defaultConfig {
multiDexEnabled true
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
dexOptions {
javaMaxHeapSize "4g"
}
这里也有同样的问题。您找到解决方案了吗?2.1.0现在已经推出并尝试使用它。我也有同样的问题。启用Multidex时,我收到错误:任务执行失败“:app:packageAllDebugClassesForMultiDex'>java.util.zip.ZipException:重复条目:net/minidev/asm/ASMUtil.clasan其他疑问:它甚至可以与Android一起工作吗?我看不出有什么理由不这样做,只是好奇而已,因为在挣扎了两天之后,我找不到任何解决方案。2.1.0现在已经推出并尝试使用它。我也有同样的问题。启用Multidex时,我收到错误:任务执行失败“:app:packageAllDebugClassesForMultiDex'>java.util.zip.ZipException:重复条目:net/minidev/asm/ASMUtil.class