You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
privatestaticvoidwrite(Stringres, Filef, Stringname) throwsThrowable {
f = newFile(f, name);
if (f.exists()) {
try (InputStreamis = SeikoApplication.getSeikoApplicationContext().getAssets().open(res);
FileInputStreamfs = newFileInputStream(f);
) {
if (is == null) thrownewInternalError("Resource `" + res + "` not found");
if (IOKit.isEq(is, fs)) return;
}
}
try (
//原工程这里读不到so,需要手动改一下InputStreamis = SeikoApplication.getSeikoApplicationContext().getAssets().open(res);
// InputStream is = NativeLoader.class.getResourceAsStream(res);OutputStreamfo = newBufferedOutputStream(newFileOutputStream(f));
) {
if (is == null) thrownewInternalError("Resource `" + res + "` not found");
IOKit.transferTo(is, fo);
}
}
经过修改后的源码可以正常加载so库,但是在加载过程中报错:
[93m2023-08-26 20:14:25 W/Bot 1693256674: An exception occurred when processing event. Subscriber scope: '<unnamed>'. Broadcaster scope: 'Bot.1693256674.EventDispatcher'
java.util.ServiceConfigurationError: net.mamoe.mirai.spi.AudioToSilkService: Provider com.kagg886.seiko.bot.service.AudioConvertService could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:233)
at java.util.ServiceLoader.-$$Nest$smfail(Unknown Source:0)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:392)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:416)
at java.util.ServiceLoader$1.next(ServiceLoader.java:494)
at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1295)
at kotlin.collections.CollectionsKt___CollectionsKt.toMutableList(_Collections.kt:1328)
at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1319)
at net.mamoe.mirai.utils.ServicesKt$loadServices$bothServices$1.invokeSuspend(Services.kt:90)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:129)
at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:787)
at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:817)
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:808)
at net.mamoe.mirai.spi.SpiServiceLoaderImpl.reloadAndSelect(SPIServiceLoader.kt:77)
at net.mamoe.mirai.spi.SpiServiceLoaderImpl.access$reloadAndSelect(SPIServiceLoader.kt:47)
at net.mamoe.mirai.spi.SpiServiceLoaderImpl$_service$2.invoke(SPIServiceLoader.kt:66)
at net.mamoe.mirai.spi.SpiServiceLoaderImpl$_service$2.invoke(SPIServiceLoader.kt:64)
at net.mamoe.mirai.utils.LateinitMutableProperty.getValue(LateinitMutableProperty.kt:47)
at net.mamoe.mirai.spi.SpiServiceLoaderImpl.get_service(SPIServiceLoader.kt:64)
at net.mamoe.mirai.spi.SpiServiceLoaderImpl.getService(SPIServiceLoader.kt:56)
at net.mamoe.mirai.spi.AudioToSilkService$Companion.getInstance(AudioToSilkService.kt:51)
at net.mamoe.mirai.internal.contact.CommonGroupImpl.uploadAudio$suspendImpl(GroupImpl.kt:362)
at net.mamoe.mirai.internal.contact.CommonGroupImpl.uploadAudio(Unknown Source:0)
at net.mamoe.mirai.contact.AudioSupported$uploadAudio$1.invoke(Unknown Source:4)
at net.mamoe.mirai.contact.AudioSupported$uploadAudio$1.invoke(Unknown Source:2)
at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:205)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
at me.him188.kotlin.jvm.blocking.bridge.internal.RunSuspendKt.$runSuspend$(RunSuspend.kt:18)
at net.mamoe.mirai.contact.AudioSupported.uploadAudio(Unknown Source:12)
at com.kagg886.seiko.dic.entity.func.impl.Ptt.run(Ptt.java:54)
at com.kagg886.seiko.dic.entity.func.Function.invoke(Function.java:169)
at com.kagg886.seiko.dic.entity.func.Function.invoke(Function.java:165)
at com.kagg886.seiko.dic.session.AbsRuntime.invoke(AbsRuntime.java:241)
at com.kagg886.seiko.dic.session.AbsRuntime.invoke0(AbsRuntime.java:185)
at com.kagg886.seiko.dic.session.AbsRuntime.invoke(AbsRuntime.java:122)
at com.kagg886.seiko.dic.DictionaryReg.lambda$reg$0(DictionaryReg.java:45)
at com.kagg886.seiko.dic.DictionaryReg$$ExternalSyntheticLambda0.accept(Unknown Source:6)
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:600)
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:600)
at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51)
at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1)
at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: java.lang.UnsatisfiedLinkError
at io.github.kasukusakura.silkcodec.NativeLoader.initialize(NativeLoader.java:25)
at com.kagg886.seiko.bot.service.AudioConvertService.<clinit>(AudioConvertService.java:40)
at java.lang.Class.newInstance(Native Method)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:388)
... 49 more
Caused by: java.lang.UnsatisfiedLinkError: Failed to load native library; @see https://github.com/KasukuSakura/silk-codec/blob/main/BUILD_NATIVE.md
at io.github.kasukusakura.silkcodec.NativeLoader.init0(NativeLoader.java:146)
at io.github.kasukusakura.silkcodec.NativeLoader.initialize(NativeLoader.java:22)
... 52 more
Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.kagg886.seiko.debug/cache/silk-linux-x64.so" is for EM_X86_64 (62) instead of EM_AARCH64 (183)
at java.lang.Runtime.load0(Runtime.java:929)
at java.lang.System.load(System.java:1625)
at io.github.kasukusakura.silkcodec.NativeLoader.init0(NativeLoader.java:136)
... 53 more
Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libstdc++.so.6" not found: needed by /data/data/com.kagg886.seiko.debug/cache/silk-linux-arm64.so in namespace classloader-namespace
at java.lang.Runtime.load0(Runtime.java:929)
at java.lang.System.load(System.java:1625)
at io.github.kasukusakura.silkcodec.NativeLoader.init0(NativeLoader.java:136)
... 53 more
Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.kagg886.seiko.debug/cache/silk-android-x86.so" is 32-bit instead of 64-bit
at java.lang.Runtime.load0(Runtime.java:929)
at java.lang.System.load(System.java:1625)
at io.github.kasukusakura.silkcodec.NativeLoader.init0(NativeLoader.java:136)
... 53 more
Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.kagg886.seiko.debug/cache/silk-android-x86_64.so" is for EM_X86_64 (62) instead of EM_AARCH64 (183)
at java.lang.Runtime.load0(Runtime.java:929)
at java.lang.System.load(System.java:1625)
at io.github.kasukusakura.silkcodec.NativeLoader.init0(NativeLoader.java:136)
... 53 more
Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found: needed by /data/data/com.kagg886.seiko.debug/cache/silk-android-arm64.so in namespace classloader-namespace
at java.lang.Runtime.load0(Runtime.java:929)
at java.lang.System.load(System.java:1625)
at io.github.kasukusakura.silkcodec.NativeLoader.init0(NativeLoader.java:136)
... 53 more
总结就是通过gradle引入无法在打包中的apk找到so文件,以及我个人修改后的so加载错误的问题
The text was updated successfully, but these errors were encountered:
implementation 'io.github.kasukusakura:silk-codec:0.0.5'
,无论是打debug还是打release,均无法寻找到so文件。assets/natives/
,并修改NativeLoader.java
如下:总结就是通过gradle引入无法在打包中的apk找到so文件,以及我个人修改后的so加载错误的问题
The text was updated successfully, but these errors were encountered: