Open shuizhizhiyin opened 1 month ago
It looks like a misconfiguration of ProGuard. consumeKeyString
uses CharSequence.indexOf
from standard library's kotlin.text.StringsKt
. Check that you didn't optimize it accidentally. Perhaps rule like this would help:
-keepclassmembers class kotlin.text.StringsKt {
public static *** indexOf(...);
}
(see explanation of rule here: https://stackoverflow.com/a/38576081/5438558)
error occur at release version, no error with debug. I have tried to add keep rules in proguard file, but take no effect!
【keep rules】 -keep class kotlinx.serialization.json.*{;} -keep class kotlin.* {;}
E AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher E AndroidRuntime: Process: com.abs.aiunit, PID: 26405 E AndroidRuntime: java.lang.NoSuchMethodError: No static method h(Ljava/lang/CharSequence;CII)I in class Lkotlin/text/StringsKt; or its super classes (declar E AndroidRuntime: at kotlinx.serialization.json.internal.StringJsonLexer.consumeKeyString(Unknown Source:12) E AndroidRuntime: at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeStringKey(Unknown Source:17) E AndroidRuntime: at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeObjectIndex(Unknown Source:14) E AndroidRuntime: at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeElementIndex(Unknown Source:26) E AndroidRuntime: at com.abs.aiunit.plugin.realtimeasr.AsrAckMessage$$serializer.deserialize(Unknown Source:68) E AndroidRuntime: at com.abs.aiunit.plugin.realtimeasr.AsrAckMessage$$serializer.deserialize(Unknown Source:0) E AndroidRuntime: at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(Unknown Source:74) E AndroidRuntime: at kotlinx.serialization.internal.m1.deserialize(Unknown Source:13) E AndroidRuntime: at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(Unknown Source:74) E AndroidRuntime: at kotlinx.serialization.json.Json.decodeFromString(Unknown Source:30) E AndroidRuntime: at com.abs.aiunit.plugin.realtimeasr.OdinRealtimeAsrClient.parseMessage(Unknown Source:21) E AndroidRuntime: at com.abs.aiunit.plugin.realtimeasr.OdinRealtimeAsrClient.access$parseMessage(Unknown Source:0) E AndroidRuntime: at com.abs.aiunit.plugin.realtimeasr.OdinRealtimeAsrClient$odinAscListener$1.onMessage(Unknown Source:40) E AndroidRuntime: at com.abs.aiunit.plugin.realtimeasr.connect.WebSocketClient$connectAsync$1$innerWebSocket$1.onMessage(Unknown Source:62) E AndroidRuntime: at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.kt:1) E AndroidRuntime: at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.kt:69) E AndroidRuntime: at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:12) E AndroidRuntime: at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:11) E AndroidRuntime: at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:122) E AndroidRuntime: at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:53) E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012)
【code 】 private fun parseMessage(jsonMsg: String): AsrAckMessage? { try { jsonMsg.also { val json = Json { ignoreUnknownKeys = true } return json.decodeFromString(it) } } catch (e: Exception) { PluginLog.e(tag, "parseMessage error:$jsonMsg", e) return null } }
are there any ways to help, thanks!