I am trying to use [boilerpipe][1] 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 output with the --debug option
Caused by: com.android.dx.cf.iface.ParseException: bad utf-8 byte a0 at offset 00000004\n\tat com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:374)\n\tat com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:262)\n\tat com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:294)\n\tat com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)\n\tat com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)\n\tat com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)\n\tat com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)\n\tat com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)\n\tat com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)\n\tat com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)\n\tat com.android.dx.command.dexer.Main.parseClass(Main.java:787)\n\tat com.android.dx.command.dexer.Main.access$1600(Main.java:88)\n\tat com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722)\n\tat com.android.dx.command.dexer.Main.processClass(Main.java:773)\n\t... 16 more\nCaused by: java.lang.IllegalArgumentException: bad utf-8 byte a0 at offset 00000004\n\tat com.android.dx.rop.cst.CstString.throwBadUtf8(CstString.java:172)\n\tat com.android.dx.rop.cst.CstString.utf8BytesToString(CstString.java:143)\n\tat com.android.dx.rop.cst.CstString.\u003cinit\u003e(CstString.java:200)\n\tat com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:371)\n\t... 29 more\n","tool":"Dex"}
13:53:36.360 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"error","text":"1 error; aborting","sources":[{}]}
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter]
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter]
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:transformClassesWithDexForDebug'.
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter] > 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
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter]
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
13:53:36.374 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
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