2015-10-19 152 views
2

我有简单的应用程序从Excel文件(2007,.xlsx)中读取单元格。Apache POI .xlsx阅读,Gradle不会构建

我正在使用https://github.com/andruhon/android5xlsx库。

我正在建造时,这个错误:http://pastebin.com/80jHfEVT(太长了)

,如果你从这里需要您可以下载我的项目:https://mega.nz/#!2xwwAAJA!vwr_I7iL_htvem_R5tuZYfcT21xhrg2z2zhMJLzmq8Y密码是“计算器”(没有“”)。

来源是同样喜欢这里:java.exe finished with non-zero exit value 1(我的问题),但现在我用这gradle这个:

Gradle.build

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 

    dexOptions { 
     preDexLibraries false 
     //incremental true 
     javaMaxHeapSize "4g" 
    } 

    afterEvaluate { 
     tasks.matching { 
      it.name.startsWith('dex') 
     }.each { dx -> 
      if (dx.additionalParameters == null) { 
       dx.additionalParameters = ['--multi-dex'] 
      } else { 
       dx.additionalParameters += '--multi-dex' 
      } 
     } 
    } 

    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/LICENSE.txt' 
    } 

    defaultConfig { 
     applicationId "tona_kriz.kriziksupl" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 

     multiDexEnabled true 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

    //project.tasks.withType(com.android.build.gradle.tasks.Dex) { 
    // additionalParameters=['--core-library'] // --core-library option needed for now, will fix it soon 
    //} 
} 

dependencies { 
    compile 'com.android.support:appcompat-v7:23.1.0' 
    compile 'com.android.support:multidex:1.0.1' 
    compile files('libs/poi-3.12-android.jar') 
    compile files('libs/poi-ooxml-schemas-3.12-20150511.jar') 
} 

有我的解决方案?

回答

1

好吧,我发现它!我需要在gradle.build中使用核心库。

project.tasks.withType(com.android.build.gradle.tasks.Dex) { 
     additionalParameters=['--core-library'] // --core-library option needed for now, will fix it soon 
    } 

(来源:https://github.com/andruhon/android5xlsx/blob/master/build.gradle

编辑:或者使用库改变的javax别的东西(等aavax)

+0

当我同步gradle时即时得到这个错误..错误:(39,0)在[email protected] –

+0

@RazelSoco上找不到属性'com'请创建一个新主题或尝试搜索一下你自己 – tonakriz

0

你为什么不试试我的解决方案?这个想法来自于同样的错误:

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

我解决我的问题的想法,这个错误导致反复引用的包,只是相信我,只是尝试:java.exe finished with non-zero exit value 1

+0

提供该库不是解决方案,没有系统库,只是写错了一个。使用该链接的库应该可以解决这个问题,因此使用“javax” - >“aavax”来解决“系统”库问题。 – tonakriz