错误:3.7库:添加POI-OOXML后执行失败的任务“:transformClassesWithDexForDebug:应用” [英] Error:Execution failed for task ':app:transformClassesWithDexForDebug' after adding poi-ooxml:3.7 library

查看:340
本文介绍了错误:3.7库:添加POI-OOXML后执行失败的任务“:transformClassesWithDexForDebug:应用”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读 XLSX 文件,所以我使用的 org.apache.poi:POI-OOXML:3.7

I want to read a XLSX file, so I am using org.apache.poi:poi-ooxml:3.7

现在我所做的一切,没有错误为止,但是当我运行该应用程序,Android的工作室给我一个奇怪的错误结果。

Now I have done everything, no errors so far, but when I am running the application, Android Studio is giving me a weird error

错误:执行失败的任务:应用程序:transformClassesWithDexForDebug。
  com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'C:\\ Program Files文件\\的Java \\ jdk1.7.0 \\斌\\ java.exe的'非零退出值完成1

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0\bin\java.exe'' finished with non-zero exit value 1

现在标记这个问题进行重复之前,让我告诉你我迄今所做的:

Now before marking this question as duplicate, let me tell you what I have done so far:

1。的build.gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "in.example.excel"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'org.apache.poi:poi-ooxml:3.7'
}

结果
2。舱单申报MultiDex 结果
<应用
        机器人:名字=android.support.multidex.MultiDexApplication
        ...

搜索结果
3。 readExcelFile(...)方法

   private void readExcelFile(String path, Context ironMaiden)
   {
    try
    {
        File iSFile = new File(path);
        FileInputStream inputStream = new FileInputStream(iSFile);

        Workbook workbook = WorkbookFactory.create(inputStream);
        org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(0);

        Row row = sheet.getRow(0);

        for (int i = 0; i < row.getLastCellNum(); i++)
        {
            Cell cell = row.getCell(i);
            Log.d("DEBUG", cell.getStringCellValue());
        }
    }
    catch (IOException | InvalidFormatException io)
    {
        io.printStackTrace();
    }
}

结果
4。重建和清洁
是的,我有重建项目,并清洗了好几遍。
我也没有通过命令行相同 gradlew干净 gradlew应用:依赖

我即将放弃这个库。请帮助。

I am about to give up on this library. Please Help.

推荐答案

我通过从外部添加两个JAR解决了这个问题。

I resolved the problem by Adding two JARs externally.


  1. POI-3.9.jar 下载

  2. POI-00xml-3.9.jar 下载

  1. poi-3.9.jar Download
  2. poi-00xml-3.9.jar Download

结果PS:请添加的JAR外部,通过行家添加它们产生令人困惑的错误


PS: Please add the JARs externally, adding them via maven generates a confusing error.

这篇关于错误:3.7库:添加POI-OOXML后执行失败的任务“:transformClassesWithDexForDebug:应用”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆