我想在android studio中使用Xstream。以下是条目
build.gradle
:
compile('com.thoughtworks.xstream:xstream:1.4.7') {
exclude module: 'xmlpull'
}
当我运行我的代码时,我得到以下异常:
"C:\Program Files\Java\jdk1.7.0_79\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files\Android\Android Studio\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\pandes4\AppData\Local\Android\sdk\platforms\android-23\android.jar;C:\Users\pandes4\AppData\Local\Android\sdk\platforms\android-23\data\res;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\classes\debug;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\recyclerview-v7\23.1.0\res;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\recyclerview-v7\23.1.0\jars\classes.jar;C:\Users\pandes4\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\support-annotations\23.1.0\support-annotations-23.1.0.jar;C:\Users\pandes4\.gradle\caches\modules-2\files-2.1\com.google.code.ksoap2-android\ksoap2-android\3.0.0\3ea828ba22ed4ecb84052e90caf1522fcef44384\ksoap2-android-3.0.0.jar;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\jars\classes.jar;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res;C:\Users\pandes4\.gradle\caches\modules-2\files-2.1\net.sourceforge.kxml\kxml\2.2.4\1642506e490548d96984b8370e44257c156097f7\kxml-2.2.4.jar;C:\Users\pandes4\.gradle\caches\modules-2\files-2.1\com.google.code.ksoap2-android\ksoap2-base\3.0.0\a5ae46b8c2407144aa6afa89cba7c3e37df273e2\ksoap2-base-3.0.0.jar;C:\Users\pandes4\.gradle\caches\modules-2\files-2.1\com.thoughtworks.xstream\xstream\1.4.7\bce3282142b63068260f021fcbe48b72e8d71a1a\xstream-1.4.7.jar;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\design\23.1.0\res;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\design\23.1.0\jars\classes.jar;C:\Users\pandes4\.gradle\caches\modules-2\files-2.1\net.sourceforge.kobjects\kobjects-j2me\0.0-SNAPSHOT-20040926-2\9246ca92b16c65114a7fb80b906801e06be95305\kobjects-j2me-0.0-SNAPSHOT-20040926-2.jar;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.1.0\res;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.1.0\jars\classes.jar;C:\Users\pandes4\Desktop\project\TransactionSigningSDK\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.1.0\jars\libs\internal_impl-23.1.0.jar;C:\Users\pandes4\.gradle\caches\modules-2\files-2.1\com.google.code.ksoap2-android\ksoap2-j2se\3.0.0\ffd2d3fe6de12c5405abecadd1f4e740daf74742\ksoap2-j2se-3.0.0.jar;C:\Users\pandes4\.gradle\caches\modules-2\files-2.1\xpp3\xpp3_min\1.1.4c\19d4e90b43059058f6e056f794f0ea4030d60b86\xpp3_min-1.1.4c.jar;C:\Program Files\Android\Android Studio\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.rsa.mobile.android.transactionsigningsdk.transaction.TransactionPayloadProcessorImpl
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jettison/mapped/Configuration
at com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver.<init>(JettisonMappedXmlDriver.java:55)
at
com.rsa.mobile.android.transactionsigningsdk.transaction.TransactionPayloadProcessorImpl.processTransactionPayload(TransactionPayloadProcessorImpl.java:16)
at com.rsa.mobile.android.transactionsigningsdk.transaction.TransactionPayloadProcessorImpl.main(TransactionPayloadProcessorImpl.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jettison.mapped.Configuration
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 8 more
使用退出代码1完成处理
我是否应该单独添加codehaus jettison库?
当我尝试向我build.gradle
添加放弃
java returned 1
异常。