简体   繁体   English

Android Studio:添加样板库后生成错误

[英]Android Studio: Build error after adding boilerpipe library

I am trying to use [boilerpipe][1] for parsing text. 我正在尝试使用[boilerpipe] [1]来解析文本。 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. 我将boilerpipe-1.2.0.jarnekohtml-1.9.13.jarxerces-2.9.1.jar到lib文件夹,并将它们添加为库。 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 这是我的应用程序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 这是带有--debug选项的输出

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? 您正在使用什么JDK版本?

You have to use the same Java version or greater than the one that was used to compile the external jars (boilerpipe). 您必须使用相同或更高的Java版本,而不是用于编译外部jar(锅炉管道)的Java版本。

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 并且此错误已填充到锅炉项目的github问题跟踪中: https : //github.com/matanster/boilerpipe/issues/74

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM