Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit 45819db

Browse files
committed
Fix No field maximumAllowableApiLevelForBcDeprecation on Android 8.1-
1 parent 04dce78 commit 45819db

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/src/main/java/io/github/mzdluo123/mirai/android/BotApplication.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ class BotApplication : Application() {
5252
* 在新版系统上无法使用ECDH算法,使用下面的代码绕过
5353
* */
5454
private fun byPassECDHCHeck() {
55-
val cls = Class.forName("sun.security.jca.Providers")
56-
val field = cls.getDeclaredField("maximumAllowableApiLevelForBcDeprecation")
57-
field.isAccessible = true
58-
field.setInt(null, 999)
55+
try {
56+
val cls = Class.forName("sun.security.jca.Providers")
57+
val field = cls.getDeclaredField("maximumAllowableApiLevelForBcDeprecation")
58+
field.isAccessible = true
59+
field.setInt(null, 999)
60+
}
61+
catch(e : Exception) {}
5962
}
6063

6164

0 commit comments

Comments
 (0)