已解决 安卓上用mirai-core登录出现异常
-
大佬们,帮忙看下咋回事呗,顺带能解决就太棒了。
报错是这样:2021-08-28 22:37:26.455 29812-29889/top.heue.mq W/System.err: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 2021-08-28 22:37:26.455 29812-29889/top.heue.mq W/System.err: SLF4J: Defaulting to no-operation (NOP) logger implementation 2021-08-28 22:37:26.455 29812-29889/top.heue.mq W/System.err: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 2021-08-28 22:37:26.483 29812-29889/top.heue.mq W/System.err: ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console... 2021-08-28 22:37:26.499 29812-29889/top.heue.mq W/top.heue.mq: Accessing hidden method Lsun/misc/VM;->maxDirectMemory()J (greylist, reflection, allowed) 2021-08-28 22:37:26.501 29812-29889/top.heue.mq W/top.heue.mq: Accessing hidden field Lsun/nio/ch/SelectorImpl;->selectedKeys:Ljava/util/Set; (greylist, reflection, allowed) 2021-08-28 22:37:26.501 29812-29889/top.heue.mq W/top.heue.mq: Accessing hidden field Lsun/nio/ch/SelectorImpl;->publicSelectedKeys:Ljava/util/Set; (greylist, reflection, allowed) 2021-08-28 22:37:26.507 29812-29812/top.heue.mq W/DefaultDispatch: type=1400 audit(0.0:26229411): avc: denied { read } for name="somaxconn" dev="proc" ino=186429504 scontext=u:r:untrusted_app:s0:c190,c258,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=top.heue.mq 2021-08-28 22:37:26.602 29812-29889/top.heue.mq V/NET: No server list cached. 2021-08-28 22:37:26.609 29812-29889/top.heue.mq W/System.err: java.security.NoSuchAlgorithmException: ECDH KeyPairGenerator not available 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:241) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDH.lambda-3$testECDH(ECDHJvmDesktop.kt:71) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDH.<clinit>(ECDHJvmDesktop.kt:82) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDHKt.adjustToPublicKey(ECDH.kt:141) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDHKt.adjustToPublicKey(ECDH.kt:136) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDHInitialPublicKey.<init>(ECDH.kt:125) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDHInitialPublicKey.<init>(ECDH.kt:123) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDHKt$defaultInitialPublicKey$2.invoke(ECDH.kt:132) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDHKt$defaultInitialPublicKey$2.invoke(ECDH.kt:132) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.utils.crypto.ECDHKt.getDefaultInitialPublicKey(ECDH.kt:132) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.AccountSecretsManagerKt.AccountSecretsImpl(AccountSecretsManager.kt:146) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.AccountSecretsManagerKt.getSecretsOrCreate(AccountSecretsManager.kt:154) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.BotClientHolderImpl.createClient(BotClientHolder.kt:36) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.BotClientHolderImpl.access$createClient(BotClientHolder.kt:24) 2021-08-28 22:37:26.610 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.BotClientHolderImpl$client$2.invoke(BotClientHolder.kt:28) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.BotClientHolderImpl$client$2.invoke(BotClientHolder.kt:28) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.utils.LateinitMutableProperty.getValue(LateinitMutableProperty.kt:38) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.BotClientHolderImpl.getClient(BotClientHolder.kt:28) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.SsoProcessorImpl.getClient(SsoProcessor.kt:97) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.components.SsoProcessorImpl.login(SsoProcessor.kt:111) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at net.mamoe.mirai.internal.network.impl.netty.NettyNetworkHandler$StateConnecting$1.invokeSuspend(NettyNetworkHandler.kt:269) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) 2021-08-28 22:37:26.611 29812-29889/top.heue.mq W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 2021-08-28 22:37:26.872 29812-29889/top.heue.mq I/NET: ECDH key is invalid, start to fetch ecdh public key from server. 2021-08-28 22:37:26.876 29812-29826/top.heue.mq I/top.heue.mq: Background concurrent copying GC freed 627212(18MB) AllocSpace objects, 6(120KB) LOS objects, 50% free, 18MB/36MB, paused 33us total 134.446ms 2021-08-28 22:37:27.356 29812-29889/top.heue.mq I/NET: Successfully fetched ecdh public key from server. 2021-08-28 22:37:27.371 29812-29889/top.heue.mq V/NET: Send: wtlogin.login 2021-08-28 22:37:28.208 29812-29869/top.heue.mq I/BOT: Login successful 2021-08-28 22:37:28.208 29812-29889/top.heue.mq V/NET: Recv: wtlogin.login 2021-08-28 22:37:28.291 29812-29889/top.heue.mq V/NET: No server list cached.
之后就这样循环打印:
2021-08-28 22:37:28.293 29812-29889/top.heue.mq I/NET: ECDH key is valid. 2021-08-28 22:37:28.307 29812-29889/top.heue.mq V/NET: Send: wtlogin.exchange_emp 2021-08-28 22:37:28.489 29812-29889/top.heue.mq V/NET: Recv: wtlogin.exchange_emp 2021-08-28 22:37:31.563 29812-29889/top.heue.mq V/NET: No server list cached. 2021-08-28 22:37:31.567 29812-29889/top.heue.mq I/NET: ECDH key is valid.
收不到消息,然后~版本2.7.0和2.8-M1试着都这样,就登录那一步后出问题。
2.6.8和之前的试了几个都构建失败了。以前2.1.1的那个打包的apk倒还能正常登录接收消息。
-
解决了,按照mirai-android中的样子换成mirai-core-android,然后版本改为2.6.8就行了,2.7.0和2.8-M1还是不行。
-
升级到2.7.0即可
-
@rainchan 就是用的2.7.0这样的
-
这很奇怪,为什么我2.7就没问题
-
提供更多信息有助于确定问题
-
@rainchan 请问需要提供点啥,日志就是这样
-
@sposer 整个项目代码
-
哦哦,这个要等会儿才有空上传,嗯,到时候@你哈
-
-
感觉是依赖的问题,mirai依赖加上-android看看
-
@rainchan 加上变成mirai-core-android,还是那样。
-
可以参考一下我的项目,我感觉我就是加了个-android就好了
-
@rainchan 好的,谢谢
-
解决了,按照mirai-android中的样子换成mirai-core-android,然后版本改为2.6.8就行了,2.7.0和2.8-M1还是不行。