Below is my app level Build.gradle
- Code: Select all
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "***************"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
debug {
// app-debug.apk is 6443 kb with minifyEnabled, 11025 kb otherwise
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'readme.html'
exclude 'license.html'
exclude 'META-INF/eclipse.inf'
}
// configurations {
// compile.exclude group: "javax.xml.bind", module: "ModuleUtil"
// }
dexOptions {
javaMaxHeapSize "4g"
additionalParameters = ['--core-library']
}
sourceSets {
main {
resources.includes = ['src/main/assets/docx4j.properties']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:28.0.0'
implementation 'javax.xml.stream:stax-api:1.0-2'
implementation 'com.fasterxml:aalto-xml:1.0.0'
implementation files('libs/awt-bastardised-17v8.jar')
implementation 'org.docx4j:docx4j:6.1.0'
implementation 'javax.xml.bind:jaxb-api:2.3.0'
implementation 'com.sun.xml.bind:jaxb-core:2.3.0'
implementation 'com.sun.xml.bind:jaxb-impl:2.3.0'
implementation 'javax.activation:activation:1.1.1'
}
- Code: Select all
inputStream = getApplicationContext().getAssets().open(fileName);
template = WordprocessingMLPackage.load(inputStream);
org.docx4j.openpackaging.exceptions.Docx4JException: Error reading from the stream
W/System.err: at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:404)
W/System.err: at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:376)
W/System.err: at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:341)