java.lang.NoClassDefFoundError:

2018-11-30  本文已影响245人  kongzue

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/util/ByteArrayBuffer 错误处理

这事发生在使用最新版本Android Studio(3.2.1)使用targetSdkVersion 28集成讯飞语音合成或百度语音合成时出现:

E/AndroidRuntime: FATAL EXCEPTION: Thread-24
    Process: com.demo.app, PID: 23690
    java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/util/ByteArrayBuffer;
        at com.demo.app.thirdparty.ae.a(Unknown Source:5)
        at com.demo.app.thirdparty.ae.b(Unknown Source:155)
        at com.demo.app.thirdparty.ae.run(Unknown Source:5)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.util.ByteArrayBuffer" on path: DexPathList[[zip file "/data/app/com.demo.app-kWGFNjSlyHIJn-KZ1AAkKw==/base.apk"],nativeLibraryDirectories=[/data/app/com.demo.app-kWGFNjSlyHIJn-KZ1AAkKw==/lib/arm64, /data/app/com.demo.app-kWGFNjSlyHIJn-KZ1AAkKw==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.demo.app.thirdparty.ae.a(Unknown Source:5) 
        at com.demo.app.thirdparty.ae.b(Unknown Source:155) 
        at com.demo.app.thirdparty.ae.run(Unknown Source:5) 

大致错误就是找不到org.apache.http.util.ByteArrayBuffer之类的,解决方法为在AndroidManifest.xml的<application>中加入以下代码:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

请尝试上述方案是否能够解决,希望能帮到你。

上一篇下一篇

猜你喜欢

热点阅读