const table = {
"00A4": 0xA1E8,
"00A7": 0xA1EC,
"00A8": 0xA1A7,
"00B0": 0xA1E3,
............
我在实现字符串转gbk编码
需要查表
定义了像上面的键值对,总共有7000多行
编译直接报错
exception: java.lang.RuntimeException: Error generating class file uts/sdk/modules/sydGetbatteryinfo/IndexKt$table$1.class (compiled from [D:\test\uniappx\uniappx\unpackage\dist\dev\app\uni_modules\syd-getbatteryinfo\utssdk\app-android\index.kt]): Method too large: uts/sdk/modules/sydGetbatteryinfo/IndexKt$table$1.<init> ()V
Caused by: org.jetbrains.org.objectweb.asm.MethodTooLargeException: Method too large: uts/sdk/modules/sydGetbatteryinfo/IndexKt$table$1.<init> ()V
const table1 = {
"00A4": 0xA1E8,
"00A7": 0xA1EC,
"00A8": 0xA1A7,
"00B0": 0xA1E3,
const table2 = {
"00A4": 0xA1E8,
"00A7": 0xA1EC,
"00A8": 0xA1A7,
"00B0": 0xA1E3,
............
我分开2个变量定义,虽然编译可以通过
但是查询的时候特别慢 table2[unicodeStr]
这个是 uts的问题还是 Android的问题呢?
我试过变成65535长度的数组,编译也是不行
有其他办法优化吗
0 个回复