user3125971 user3125971 - 16 days ago 8
Java Question

Android Studio: Build error after adding boilerpipe library

I am trying to use boilerpipe for parsing text. I copied boilerpipe-1.2.0.jar, nekohtml-1.9.13.jar and xerces-2.9.1.jar to lib folder and added them as library. But when i try to run the project i get a huge error. Here is its end portion-

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


Here is my app build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.pushpankar.reader"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/boilerpipe-1.2.0/lib/xerces-2.9.1.jar')
compile files('libs/boilerpipe-1.2.0/lib/nekohtml-1.9.13.jar')
compile files('libs/boilerpipe-1.2.0/boilerpipe-1.2.0.jar')
}


Here is the link to output with the --debug option pastebin

Answer

What is your JDK version you are using?

You have to use the same Java version or greater than the one that was used to compile the external jars (boilerpipe).

UPDATE:

From the error log you posted it looks like the error is:

java.lang.IllegalArgumentException: bad utf-8 byte

and this error has been filled in the github issue tracking of the boilerpipe project: https://github.com/matanster/boilerpipe/issues/74