Apache POI .xlsx 读取,Gradle 不会构建
Apache POI .xlsx reading, Gradle won't build
我有一个简单的应用程序可以从 Excel 文件 (2007, .xlsx) 中读取单元格。
我正在使用 https://github.com/andruhon/android5xlsx 个库。
构建时出现此错误:http://pastebin.com/80jHfEVT(太长)
如果需要,您可以从这里下载我的项目:https://mega.nz/#!2xwwAAJA!vwr_I7iL_htvem_R5tuZYfcT21xhrg2z2zhMJLzmq8Y 密码 "Whosebug"(不带“”)。
来源与此处相同:(我的问题),但我现在正在使用此 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')
}
我有什么解决方案吗?
你为什么不试试我的解决方案?这个想法来自同一个错误:
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
我的想法解决了我的问题,这个错误是由重复引用包引起的,相信我,试试吧:
好的,我找到了!我需要在 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)的库
这是一个编译错误:
Could not find property 'com' on
com.android.build.gradle.AppExtension_Decorated@10348e79.
gradle for android 不再与该属性兼容。看看这个 repo https://github.com/andruhon/android5xlsx
中的配置
我有一个简单的应用程序可以从 Excel 文件 (2007, .xlsx) 中读取单元格。
我正在使用 https://github.com/andruhon/android5xlsx 个库。
构建时出现此错误:http://pastebin.com/80jHfEVT(太长)
如果需要,您可以从这里下载我的项目:https://mega.nz/#!2xwwAAJA!vwr_I7iL_htvem_R5tuZYfcT21xhrg2z2zhMJLzmq8Y 密码 "Whosebug"(不带“”)。
来源与此处相同:
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')
}
我有什么解决方案吗?
你为什么不试试我的解决方案?这个想法来自同一个错误:
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
我的想法解决了我的问题,这个错误是由重复引用包引起的,相信我,试试吧:
好的,我找到了!我需要在 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)的库
这是一个编译错误:
Could not find property 'com' on com.android.build.gradle.AppExtension_Decorated@10348e79.
gradle for android 不再与该属性兼容。看看这个 repo https://github.com/andruhon/android5xlsx
中的配置