简体   繁体   中英

Android Studio: java.lang.NoClassDefFoundError from boilerpipe

I am trying to use boilerpipe for getting text article like the pocket app. App compile properly but gives runtime exception:

java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:309)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)
  Caused by: java.lang.NoClassDefFoundError: de.l3s.boilerpipe.sax.BoilerpipeHTMLParser
    at de.l3s.boilerpipe.sax.BoilerpipeSAXInput.getTextDocument(BoilerpipeSAXInput.java:51)
    at de.l3s.boilerpipe.extractors.ExtractorBase.getText(ExtractorBase.java:69)
    at de.l3s.boilerpipe.extractors.ExtractorBase.getText(ExtractorBase.java:87)
    at com.example.pushpankar.fastreader.ReadView$fetchUrlTxt.doInBackground(ReadView.java:154)
    at com.example.pushpankar.fastreader.ReadView$fetchUrlTxt.doInBackground(ReadView.java:147)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
    at java.lang.Thread.run(Thread.java:818) 

Here are the things that i have already tried:

  1. Clean and build project
  2. gradlew clean
  3. Add library by different methods

I saw same bug has been posted on the github.

Here is my build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.example.pushpankar.fastreader"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    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 project(':boilerpipe-1.2.0-android')
    compile project(':xerces-for-android')
    compile project(':nekohtml')
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.android.support:support-v4:25.0.1'
    testCompile 'junit:junit:4.12'
    compile files('libs/slf4j-android-1.6.1-RC1.jar')
}

似乎您正在使用一些混淆器,将其重命名为其他字符,这会产生错误?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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