[Solved] java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/util/ByteArrayBuffer

A project that has not been updated for a long time is flashing after updating targetSdkVersion = 30 (below 29 has been mercilessly abandoned…) , this following error is reported:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/util/ByteArrayBuffer;
at com.iflytek.cloud.thirdparty.an.a(SourceFile:178)
at com.iflytek.cloud.thirdparty.an.b(SourceFile:309)
at com.iflytek.cloud.thirdparty.an.run(SourceFile:163)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.util.ByteArrayBuffer" on path: DexPathList[[zip file "/data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/base.apk"],nativeLibraryDirectories=[/data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/lib/arm, /data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/base.apk!/lib/armeabi-v7a, /system/lib, /hw_product/lib]]
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/util/ByteArrayBuffer; at com.iflytek.cloud.thirdparty.an.a(SourceFile:178) at com.iflytek.cloud.thirdparty.an.b(SourceFile:309) at com.iflytek.cloud.thirdparty.an.run(SourceFile:163) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.util.ByteArrayBuffer" on path: DexPathList[[zip file "/data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/base.apk"],nativeLibraryDirectories=[/data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/lib/arm, /data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/base.apk!/lib/armeabi-v7a, /system/lib, /hw_product/lib]]
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/util/ByteArrayBuffer;
        at com.iflytek.cloud.thirdparty.an.a(SourceFile:178)
        at com.iflytek.cloud.thirdparty.an.b(SourceFile:309)
        at com.iflytek.cloud.thirdparty.an.run(SourceFile:163)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.util.ByteArrayBuffer" on path: DexPathList[[zip file "/data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/base.apk"],nativeLibraryDirectories=[/data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/lib/arm, /data/app/com.qjtc.magicalar-7__z6vqbyO2enmVlUO8V7A==/base.apk!/lib/armeabi-v7a, /system/lib, /hw_product/lib]]

Can’t find the class ByteArrayBuffer is deprecated, add org.apache.http.legacy to introduce this library.

Solution: Add the following codes in the <application> tag of AndroidManifest.xml:

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

Read More: