Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android上Excel创建的XMLBeans 2.6异常_Java_Android_Excel_Apache Poi - Fatal编程技术网

Java Android上Excel创建的XMLBeans 2.6异常

Java Android上Excel创建的XMLBeans 2.6异常,java,android,excel,apache-poi,Java,Android,Excel,Apache Poi,我正在尝试使用ApachePOI3.14库创建.xlsx文档 这是我的Gradle配置: (...) defaultConfig { applicationId "com.example.app" minSdkVersion 14 targetSdkVersion 19 multiDexEnabled true } buildTypes {

我正在尝试使用ApachePOI3.14库创建
.xlsx
文档

这是我的Gradle配置:

(...)    
defaultConfig {
            applicationId "com.example.app"
            minSdkVersion 14
            targetSdkVersion 19

            multiDexEnabled true

        }

        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt')
                proguardFile 'Path/app/proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile 'com.android.support:appcompat-v7:22.2.0'
        compile 'com.android.support:multidex:1.0.1'
        //compile files('libs/android-support-v13.jar')
        compile files('libs/commons-io-2.4.jar')
        compile files('libs/commons-net-3.3.jar')
        compile files('libs/poi-3.14-20160307.jar')
        compile files('libs/poi-ooxml-3.14-20160307.jar')
        compile files('libs/poi-ooxml-schemas-3.14-20160307.jar')
        compile files('libs/xmlbeans-2.6.0.jar')
        compile files('libs/curvesapi-1.03.jar')
        compile files('libs/commons-codec-1.10.jar')
        compile files('libs/commons-logging-1.2.jar')
        compile files('libs/junit-4.12.jar')
        compile files('libs/log4j-1.2.17.jar')
        compile 'com.roomorama:caldroid:2.3.1'

    }
使用原始的xmlbeans库
xmlbeans-2.6.0.jar
我在尝试运行应用程序时遇到此异常

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/xmlbeans/xml/stream/Location.class
我已尝试使用此方法删除重复的类

-Unzip the jar file. (Simply change .jar extension to .zip
-This will remove the duplicate files.
-Recreate the jar using jar cf xmlbeans.jar -C (path to unzipped folder) . (Mind it, there is a dot in the end of command)
-Use this regenerated jar
当我尝试使用这个重新编译的.jar运行应用程序时,我收到了这个警告,但即使如此,它还是会被启动到设备上

    Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
    Error:(org.apache.xmlbeans.impl.inst2xsd.RussianDollStrategy$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.
(...)
然后,在我的代码中尝试执行以下操作:

XSSFWorkbook wb = new XSSFWorkbook();
我收到此异常并关闭应用程序

     Caused by: java.lang.NoClassDefFoundError: javax.xml.stream.XMLEventFactory
    at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41)
 at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:162) 
 at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:142) 
 at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:37) 
 at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:67) 
 at org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:344) 
 at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:453) 
 at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:226) 
 at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:218) 
 at com.asde.armatest.persistency.AsyncExcelFile.doInBackground(AsyncExcelFile.java:285) 
原因:java.lang.NoClassDefFoundError:javax.xml.stream.XMLEventFactory
位于org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.(PackagePropertiesMarshaller.java:41)
位于org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:162)
位于org.apache.poi.openxml4j.opc.OPCPackage(OPCPackage.java:142)
位于org.apache.poi.openxml4j.opc.Package.(Package.java:37)
在org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:67)
位于org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:344)
位于org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:453)
位于org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:226)
位于org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:218)
位于com.asde.armatest.persistency.AsyncExcelFile.doInBackground(AsyncExcelFile.java:285)
有什么问题吗?

我找到了重新打包的版本。这是一个有点有限,但为我的需要工作得很好。它适用于Android 4,适用于Android 5

谢谢

我找到了重新打包的版本。这是一个有点有限,但为我的需要工作得很好。它适用于Android 4,适用于Android 5


谢谢

可能重复的我已经完成了此线程上的所有建议,问题依然存在。可能重复的我已经完成了此线程上的所有建议,问题依然存在。