目录

The BC provider no longer provides for KeyPairGenerator.RSA.

发生报错

使用网路相关框架时发生报错

1
java.lang.AssertionError: java.security.NoSuchAlgorithmException: The BC provider no longer provides an implementation for KeyPairGenerator.RSA. Please see https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html for more details.

解决方案

在AndroidManifest.xml文件中填写这段代码

仅需在元application添加配置即可,其他结构代码仅为application说明位置

1
2
3
4
5
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.mypackage.mylibrary">
    <application
        android:usesCleartextTraffic="true" />
</manifest>