任务':app:preDexDebug'的执行失败。 > com.android.ide.common.process.ProcessException:

时间:2015-06-29 10:43:16

标签: android apache-poi android-gradle

我正在尝试将apache POI库与我的Android应用程序集成。为此我已经将apache poi jar文件添加到我的libs文件夹中并使用“编译文件”我正在通过build.gradle进行编译。但是当我做gradle同步时,它没有任何问题。在进行gradle同步之后,当我尝试运行应用程序时,我得到错误Execution Failed for task':app:preDexDebug'。

我见过以下类似的问题,但没有用。

Error: Execution failed for task ':app:preDexDebug'

https://stackoverflow.com/questions/27437049/android-studio-gradle-execution-failed-for-task-apppredexdebug

以下是我的gradle依赖:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.1'
compile files('libs/poi-3.12-20150511.jar')
compile files('libs/poi-ooxml-3.12-20150511.jar')
compile files('libs/poi-ooxml-schemas-3.12-20150511.jar')
compile files('libs/xmlbeans-2.6.0.jar') 
}

错误讯息:

Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException: 
  Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' 
  finished with non-zero exit value 1

Gradle控制台输出:

:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:preDexDebug
AGPBI: {"kind":"SIMPLE","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","position":{},"original":"warning: Ignoring InnerClasses attribute for an anonymous inner class"}
AGPBI: {"kind":"SIMPLE","text":"(org.apache.xmlbeans.XmlBeans$1) that doesn\u0027t come with an","position":{},"original":"(org.apache.xmlbeans.XmlBeans$1) that doesn\u0027t come with an"}
AGPBI: {"kind":"SIMPLE","text":"associated EnclosingMethod attribute. This class was probably produced by a","position":{},"original":"associated EnclosingMethod attribute. This class was probably produced by a"}
AGPBI: {"kind":"SIMPLE","text":"compiler that did not target the modern .class file format. The recommended","position":{},"original":"compiler that did not target the modern .class file format. The recommended"}
AGPBI: {"kind":"SIMPLE","text":"solution is to recompile the class from source, using an up-to-date compiler","position":{},"original":"solution is to recompile the class from source, using an up-to-date compiler"}
AGPBI: {"kind":"SIMPLE","text":"and without specifying any \"-target\" type options. The consequence of ignoring","position":{},"original":"and without specifying any \"-target\" type options. The consequence of ignoring"}
AGPBI: {"kind":"SIMPLE","text":"this warning is that reflective operations on this class will incorrectly","position":{},"original":"this warning is that reflective operations on this class will incorrectly"}
AGPBI: {"kind":"SIMPLE","text":"indicate that it is *not* an inner class.","position":{},"original":"indicate that it is *not* an inner class."}
AGPBI: {"kind":"SIMPLE","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","position":{},"original":"warning: Ignoring InnerClasses attribute for an anonymous inner class"}
AGPBI: {"kind":"SIMPLE","text":"(org.apache.xmlbeans.XmlSimpleList$1) that doesn\u0027t come with an","position":{},"original":"(org.apache.xmlbeans.XmlSimpleList$1) that doesn\u0027t come with an"}
AGPBI: {"kind":"SIMPLE","text":"associated EnclosingMethod attribute. This class was probably produced by a","position":{},"original":"associated EnclosingMethod attribute. This class was probably produced by a"}
AGPBI: {"kind":"SIMPLE","text":"compiler that did not target the modern .class file format. The recommended","position":{},"original":"compiler that did not target the modern .class file format. The recommended"}
AGPBI: {"kind":"SIMPLE","text":"solution is to recompile the class from source, using an up-to-date compiler","position":{},"original":"solution is to recompile the class from source, using an up-to-date compiler"}
AGPBI: {"kind":"SIMPLE","text":"and without specifying any \"-target\" type options. The consequence of ignoring","position":{},"original":"and without specifying any \"-target\" type options. The consequence of ignoring"}
AGPBI: {"kind":"SIMPLE","text":"this warning is that reflective operations on this class will incorrectly","position":{},"original":"this warning is that reflective operations on this class will incorrectly"}
AGPBI: {"kind":"SIMPLE","text":"indicate that it is *not* an inner class.","position":{},"original":"indicate that it is *not* an inner class."}
AGPBI: {"kind":"SIMPLE","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","position":{},"original":"warning: Ignoring InnerClasses attribute for an anonymous inner class"}
AGPBI: {"kind":"SIMPLE","text":"(org.apache.xmlbeans.XmlSimpleList$2) that doesn\u0027t come with an","position":{},"original":"(org.apache.xmlbeans.XmlSimpleList$2) that doesn\u0027t come with an"}
AGPBI: {"kind":"SIMPLE","text":"associated EnclosingMethod attribute. This class was probably produced by a","position":{},"original":"associated EnclosingMethod attribute. This class was probably produced by a"}
AGPBI: {"kind":"SIMPLE","text":"compiler that did not target the modern .class file format. The recommended","position":{},"original":"compiler that did not target the modern .class file format. The recommended"}
AGPBI: {"kind":"SIMPLE","text":"solution is to recompile the class from source, using an up-to-date compiler","position":{},"original":"solution is to recompile the class from source, using an up-to-date compiler"}
AGPBI: {"kind":"SIMPLE","text":"and without specifying any \"-target\" type options. The consequence of ignoring","position":{},"original":"and without specifying any \"-target\" type options. The consequence of ignoring"}
AGPBI: {"kind":"SIMPLE","text":"this warning is that reflective operations on this class will incorrectly","position":{},"original":"this warning is that reflective operations on this class will incorrectly"}
AGPBI: {"kind":"SIMPLE","text":"indicate that it is *not* an inner class.","position":{},"original":"indicate that it is *not* an inner class."}
AGPBI: {"kind":"SIMPLE","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","position":{},"original":"warning: Ignoring InnerClasses attribute for an anonymous inner class"}
AGPBI: {"kind":"SIMPLE","text":"(org.apache.xmlbeans.impl.regex.SchemaRegularExpression$1) that doesn\u0027t come with an","position":{},"original":"(org.apache.xmlbeans.impl.regex.SchemaRegularExpression$1) that doesn\u0027t come with an"}
AGPBI: {"kind":"SIMPLE","text":"associated EnclosingMethod attribute. This class was probably produced by a","position":{},"original":"associated EnclosingMethod attribute. This class was probably produced by a"}
AGPBI: {"kind":"SIMPLE","text":"compiler that did not target the modern .class file format. The recommended","position":{},"original":"compiler that did not target the modern .class file format. The recommended"}
AGPBI: {"kind":"SIMPLE","text":"solution is to recompile the class from source, using an up-to-date compiler","position":{},"original":"solution is to recompile the class from source, using an up-to-date compiler"}
AGPBI: {"kind":"SIMPLE","text":"and without specifying any \"-target\" type options. The consequence of ignoring","position":{},"original":"and without specifying any \"-target\" type options. The consequence of ignoring"}
AGPBI: {"kind":"SIMPLE","text":"this warning is that reflective operations on this class will incorrectly","position":{},"original":"this warning is that reflective operations on this class will incorrectly"}
AGPBI: {"kind":"SIMPLE","text":"indicate that it is *not* an inner class.","position":{},"original":"indicate that it is *not* an inner class."}
AGPBI: {"kind":"SIMPLE","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","position":{},"original":"warning: Ignoring InnerClasses attribute for an anonymous inner class"}
AGPBI: {"kind":"SIMPLE","text":"(org.apache.xmlbeans.impl.regex.SchemaRegularExpression$2) that doesn\u0027t come with an","position":{},"original":"(org.apache.xmlbeans.impl.regex.SchemaRegularExpression$2) that doesn\u0027t come with an"}
AGPBI: {"kind":"SIMPLE","text":"associated EnclosingMethod attribute. This class was probably produced by a","position":{},"original":"associated EnclosingMethod attribute. This class was probably produced by a"}
AGPBI: {"kind":"SIMPLE","text":"compiler that did not target the modern .class file format. The recommended","position":{},"original":"compiler that did not target the modern .class file format. The recommended"}
AGPBI: {"kind":"SIMPLE","text":"solution is to recompile the class from source, using an up-to-date compiler","position":{},"original":"solution is to recompile the class from source, using an up-to-date compiler"}
AGPBI: {"kind":"SIMPLE","text":"and without specifying any \"-target\" type options. The consequence of ignoring","position":{},"original":"and without specifying any \"-target\" type options. The consequence of ignoring"}
AGPBI: {"kind":"SIMPLE","text":"this warning is that reflective operations on this class will incorrectly","position":{},"original":"this warning is that reflective operations on this class will incorrectly"}
AGPBI: {"kind":"SIMPLE","text":"indicate that it is *not* an inner class.","position":{},"original":"indicate that it is *not* an inner class."}
AGPBI: {"kind":"SIMPLE","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","position":{},"original":"warning: Ignoring InnerClasses attribute for an anonymous inner class"}
AGPBI: {"kind":"SIMPLE","text":"(org.apache.xmlbeans.impl.regex.SchemaRegularExpression$3) that doesn\u0027t come with an","position":{},"original":"(org.apache.xmlbeans.impl.regex.SchemaRegularExpression$3) that doesn\u0027t come with an"}
AGPBI: {"kind":"SIMPLE","text":"associated EnclosingMethod attribute. This class was probably produced by a","position":{},"original":"associated EnclosingMethod attribute. This class was probably produced by a"}
AGPBI: {"kind":"SIMPLE","text":"compiler that did not target the modern .class file format. The recommended","position":{},"original":"compiler that did not target the modern .class file format. The recommended"}
AGPBI: {"kind":"SIMPLE","text":"solution is to recompile the class from source, using an up-to-date compiler","position":{},"original":"solution is to recompile the class from source, using an up-to-date compiler"}
AGPBI: {"kind":"SIMPLE","text":"and without specifying any \"-target\" type options. The consequence of ignoring","position":{},"original":"and without specifying any \"-target\" type options. The consequence of ignoring"}
AGPBI: {"kind":"SIMPLE","text":"this warning is that reflective operations on this class will incorrectly","position":{},"original":"this warning is that reflective operations on this class will incorrectly"}
AGPBI: {"kind":"SIMPLE","text":"indicate that it is *not* an inner class.","position":{},"original":"indicate that it is *not* an inner class."}
AGPBI: {"kind":"SIMPLE","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","position":{},"original":"warning: Ignoring InnerClasses attribute for an anonymous inner class"}
AGPBI: {"kind":"SIMPLE","text":"(org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl$SchemaTypeLoaderCache$1) that doesn\u0027t come with an","position":{},"original":"(org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl$SchemaTypeLoaderCache$1) that doesn\u0027t come with an"}
AGPBI: {"kind":"SIMPLE","text":"associated EnclosingMethod attribute. This class was probably produced by a","position":{},"original":"associated EnclosingMethod attribute. This class was probably produced by a"}
AGPBI: {"kind":"SIMPLE","text":"compiler that did not target the modern .class file format. The recommended","position":{},"original":"compiler that did not target the modern .class file format. The recommended"}
AGPBI: {"kind":"SIMPLE","text":"solution is to recompile the class from source, using an up-to-date compiler","position":{},"original":"solution is to recompile the class from source, using an up-to-date compiler"}
AGPBI: {"kind":"SIMPLE","text":"and without specifying any \"-target\" type options. The consequence of ignoring","position":{},"original":"and without specifying any \"-target\" type options. The consequence of ignoring"}
AGPBI: {"kind":"SIMPLE","text":"this warning is that reflective operations on this class will incorrectly","position":{},"original":"this warning is that reflective operations on this class will incorrectly"}
AGPBI: {"kind":"SIMPLE","text":"indicate that it is *not* an inner class.","position":{},"original":"indicate that it is *not* an inner class."}
AGPBI: {"kind":"SIMPLE","text":"warning: Ignoring InnerClasses attribute for an anonymous inner class","position":{},"original":"warning: Ignoring InnerClasses attribute for an anonymous inner class"}
AGPBI: {"kind":"SIMPLE","text":"(org.apache.xmlbeans.impl.validator.ValidatingXMLInputStream$1) that doesn\u0027t come with an","position":{},"original":"(org.apache.xmlbeans.impl.validator.ValidatingXMLInputStream$1) that doesn\u0027t come with an"}

FAILED

失败:构建因异常而失败。

  • 出了什么问题: 任务':app:preDexDebug'执行失败。

      

    com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\ Program Files \ Java \ jdk1.8.0_31 \ bin \ java.exe''已完成具有非零退出值1

  • 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。

建立失败

总时间:22.982秒

2 个答案:

答案 0 :(得分:1)

过去两天我遇到了这个错误,最后我决定寻找替代方法在Android应用程序中创建excel表。

我尝试使用“aspose”库,与“apache Poi”和“jxl”库相比,它真的很容易使用。

“Aspose”库的链接以及如何在android项目中使用。

http://www.aspose.com/android/total-component.aspx

https://github.com/asposecells/Aspose_Cells_Android

感谢在这种情况下帮助过我的每个人。

答案 1 :(得分:0)

  1. 您是否尝试过以下顺序(按此顺序):使缓存无效& restart => gradle sync => gradle clean => gradle build?

  2. 在File =>项目结构=> SDK位置:您是否将JDK位置设置为指向JDK 7的有效安装?

  3. 你在模块的build.gradle中是否有这个触发错误:

    android {
        ...
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }