在尝试创建 deviceInfo 时出现有关 mirai-console 的错误。项目并未引入mirai-console,仅使用mirai-core。
运行平台:Android。
FATAL EXCEPTION: main
Process: com.ojhdtapp.miraipluginforparabox, PID: 19010
java.lang.NoClassDefFoundError: Failed resolution of: Lnet/mamoe/mirai/console/plugin/ResourceContainer;
at xyz.cssxsh.mirai.device.MiraiDeviceGenerator.<init>(MiraiDeviceGenerator.kt:23)
at com.ojhdtapp.miraipluginforparabox.domain.service.ConnService$onStartParabox$1.invokeSuspend(ConnService.kt:135)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7866)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@7499cc9, Dispatchers.Main.immediate]
Caused by: java.lang.ClassNotFoundException: Didn't find class "net.mamoe.mirai.console.plugin.ResourceContainer" on path: DexPathList[[dex file "/data/data/com.ojhdtapp.miraipluginforparabox/code_cache/.overlay/base.apk/classes7.dex", dex file "/data/data/com.ojhdtapp.miraipluginforparabox/code_cache/.overlay/base.apk/classes8.dex", zip file "/data/app/~~cTHhr43bbruizziS6gpCLA==/com.ojhdtapp.miraipluginforparabox-nsYMt09QFK8GYbqftdx-yA==/base.apk"],nativeLibraryDirectories=[/data/app/~~cTHhr43bbruizziS6gpCLA==/com.ojhdtapp.miraipluginforparabox-nsYMt09QFK8GYbqftdx-yA==/lib/arm64, /data/app/~~cTHhr43bbruizziS6gpCLA==/com.ojhdtapp.miraipluginforparabox-nsYMt09QFK8GYbqftdx-yA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 12 more
启动代码:
bot = BotFactory.newBot(account, password) {
...
deviceInfo = MiraiDeviceGenerator()::load
}.also {
it.login()
}