2016-08-16 38 views
0

這個問題讓我頭痛很多小時! 每次我添加了Apache POI 3.14 lib放到Android Studio中,我得到了同樣的錯誤:當我添加Apache POI庫時獲取「:app:mergeDebugResources FAILED」

Error:Execution failed for task ':app:mergeDebugResources'. 
> -1 

我不能運行我的應用程序,我試圖既乾淨且無任何succses重建項目都沒有。

這是我下載二進制分發文件(ZIP):https://poi.apache.org/download.html

,然後我打開它,並添加jar文件poi-3.14-20160307.jar爲Android Studio中一個lib!

我想用這個庫來讀取Android中的XLS/XLSX文件。

這就是在gradle這個控制檯中顯示:

BUILD FAILED 

Total time: 2.206 secs 
Executing tasks: [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug] 

Configuration on demand is an incubating feature. 
Incremental java compilation is an incubating feature. 
:app:clean 
:app:preBuild UP-TO-DATE 
:app:preDebugBuild UP-TO-DATE 
:app:checkDebugManifest 
:app:preReleaseBuild UP-TO-DATE 
:app:prepareComAndroidSupportAnimatedVectorDrawable2411Library 
:app:prepareComAndroidSupportAppcompatV72411Library 
:app:prepareComAndroidSupportSupportV42411Library 
:app:prepareComAndroidSupportSupportVectorDrawable2411Library 
:app:prepareDebugDependencies 
:app:compileDebugAidl 
:app:compileDebugRenderscript 
:app:generateDebugBuildConfig 
:app:mergeDebugShaders 
:app:compileDebugShaders 
:app:generateDebugAssets 
:app:mergeDebugAssets 
:app:generateDebugResValues UP-TO-DATE 
:app:generateDebugResources 
:app:mergeDebugResources FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:mergeDebugResources'. 
> -1 
+0

打開gradle控制檯,請檢查錯誤。並讓我知道。 – Rahul

+0

@Rah我已經發布了 – Muddz

回答

2

請注意,有一些的,你可能會在Android上使用Apache POI時遇到問題。通常,Android應用程序無法構建,因爲XmlBeans中存在太多的方法或重複的類或其他與構建相關的問題。

目前有兩個項目,其中試圖解決大部分的問題給你:

第一種是目前基於POI

  1. https://github.com/andruhon/android5xlsx
  2. https://github.com/centic9/poi-on-android/(由我mainted) 3.12,而第二個可以更容易地用更新版本的POI重新編譯。