当我使用 Android Studio 构建我的应用程序时,我遇到了这个错误。APK 已编译,但当我尝试在 Android P 模拟器上运行该应用程序时,它会崩溃并抛出以下错误。请在附件中查看更多详细信息:
java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion
这是我的 build.grade 文件。如果有人对可能出现的问题提出建议,我将不胜感激。非常感谢。
android {
compileSdkVersion 'android-P'
buildToolsVersion '28-rc1'
useLibrary 'org.apache.http.legacy'
//for Lambda
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
defaultConfig {
applicationId "xxx.xxx.xxx"
minSdkVersion 17
targetSdkVersion 27
versionCode xxxx
versionName "Vx.x.x"
multiDexEnabled true
//other setting required
ndk {
abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a', 'x86', 'x86_64', 'mips', 'mips64'
}