2016-08-21 20 views
1

我正在开发一个需要xml读取功能的应用程序。然后通过导入jar文件使用javax.xml.stream库。我正在使用Android工作室。transformClassesWithDexForDebug错误导入javax.xml.stream

在哪里下载JAR文件中的链接:jar link

不过,我打造的应用程序遇到错误。

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.commons.digester.ExtendedBaseRules$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is not an inner class.

错误:执行任务':app:transformClassesWithDexForDebug'失败。

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

我已经通过stackoverflow搜索,但没有发布后工作对我来说。任何人都可以帮助我摆脱这个混乱!谢谢!

更新

我无法找出使用javax.xml.stream工作液。我最终用org.xmlpull.v1.XmlPullParser代替。希望这可以帮助别人,并且仍然希望有人能够用xml流库修复错误。

回答

0

添加那些你appgradle.build文件:

android { 
    // ...your other project settings... 
    project.tasks.withType(com.android.build.gradle.tasks.Dex) { 
     additionalParameters=['--core-library'] 
    } 
} 
dependencies { 
    // ...deps settings... 
    compile 'com.android.support:multidex:1.0.0' //enable multi-dex 

} 
+0

感谢@Nir段的回复。当我将上面的代码添加到我的应用程序gradle构建中时,在gradle sync时出现错误:“无法获取com.android.build.gradle.AppExtension类型的对象的未知属性'com'。”你能指导我克服它吗? – meaholik