一个很久没有更新的项目在更新targetSdkVersion = 30 后出现闪退(低于29已被无情抛弃..),报此错误:
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]]
找不到该类ByteArrayBuffer已被废弃,添加org.apache.http.legacy引入此库,
解决方法,在AndroidManifest.xml的<application>标签中添加:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>