我收到了这个错误:
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:849)
Caused by: java.lang.NoClassDefFoundError: org.jsoup.Jsoup
问题是并非所有Android版本都会出现此错误。例如Android 6运行良好,而Android 4.3抛出此错误。有人可以帮我做什么吗?
我的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId 'com.test'
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'se.simbio.encryption:library:1.2.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile files('libs/jsoup-1.9.2.jar')
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
}
答案 0 :(得分:1)
我找到了解决方案。我不知道为什么,但我已经包括了整个'游戏服务:8.4.0'。因为我必须启用multiDexEnabled并且我得到了这个NoClassDefFoundError。所以没有multiDexEnabled一切正常。
答案 1 :(得分:0)
您可以尝试不添加此行compile files('libs/jsoup-1.9.2.jar')
吗?并给我一个反馈意见?