Closed leelonely closed 7 months ago
是同一个 apk 吗?
你的 assets 目录有放模型文件么。
是同一个 apk 吗?
你的 assets 目录有放模型文件么。
对,模型肯定有啊。是同一个apk,我在骁龙的手机运行是好的,语音识别都是好的,但是如果通过android studio 把另一部天玑(vivo s12)手机插上去,程序install成功,但是调试时 oncreate中initmodel部分到了我说的 newFromAsset(assetManager, config) 就崩溃了。
是最新的代码吗,即是master的代码么
是最新的代码吗,即是master的代码么
一个星期前下的。git clone https://github.com/k2-fsa/sherpa-ncnn.git ,不过我为了节省时间,so库是从sherpa-ncnn-2.1.10-cpu-arm64-v8a-bilingual-en-zh.apk中拷贝出来的。刚用最新的代码编译出了so,也是不行的。还是一样的情况。
我们也遇到相同的问题,同一个 APK,在其它手机上都正常,唯独在 Google Pixel 6a(Android 14) 上,init 就会 crash。
我们也遇到相同的问题,同一个 APK,在其它手机上都正常,唯独在 Google Pixel 6a(Android 14) 上,init 就会 crash。
可以抓到 logcat 的 log 吗?
我把上面关键的 log 贴一下
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A uid: 10318
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xb4000077ad159000
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A x0 b4000077ad1317a0 x1 b4000077ad158fe0 x2 6170726568530a36 x3 0000000000000000
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A x4 0000000000000000 x5 0000000000000000 x6 607360436073644c x7 7f7f7f7f7f7f7f7f
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A x8 0101010101010101 x9 0000000000000004 x10 0000007fd96b7c70 x11 ffffff80ffffffd0
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A x12 b4000075c9092c70 x13 0000000000000003 x14 0000000000000000 x15 0000000000000000
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A x16 00000077b38e6fe8 x17 00000077b3866040 x18 00000077ca480000 x19 ffffffffffffffff
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A x20 b4000075c9092c70 x21 00000077c98f9c00 x22 b4000075c9092c70 x23 00000077c98f9c00
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A x24 0000007fd96b83d0 x25 0000007fd96b84d0 x26 0000000014049298 x27 0000007fd96b8688
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A x28 0000007fd96b8218 x29 0000007fd96b7a60
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A lr 00000077b389a3f4 sp 0000007fd96b7a60 pc 00000077b38660e0 pst 0000000060001000
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A 47 total frames
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A backtrace:
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #00 pc 00000000000580e0 /apex/com.android.runtime/lib64/bionic/libc.so (__strlen_aarch64+160) (BuildId: 33ad5959e2b38fc822cda3c642e16c94)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #01 pc 000000000008c3f0 /apex/com.android.runtime/lib64/bionic/libc.so (__strlen_chk+16) (BuildId: 33ad5959e2b38fc822cda3c642e16c94)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #02 pc 00000000000b2fa4 /apex/com.android.runtime/lib64/bionic/libc.so (vsscanf+132) (BuildId: 33ad5959e2b38fc822cda3c642e16c94)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #03 pc 00000000000c5074 /apex/com.android.runtime/lib64/bionic/libc.so (sscanf+116) (BuildId: 33ad5959e2b38fc822cda3c642e16c94)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #04 pc 000000000010ba90 /data/app/~~u26UCHHl8zUeRe1CIUegZQ==/com.-GChOU2ts_v4A7wLG3B-W7w==/base.apk!libncnn.so (offset 0x1ef6000) (ncnn::DataReaderFromAndroidAsset::scan(char const*, void*) const+164) (BuildId: 1627564bc24cb9cf2a9a20614562ab216f573104)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #05 pc 000000000011c6b0 /data/app/~~u26UCHHl8zUeRe1CIUegZQ==/com.-GChOU2ts_v4A7wLG3B-W7w==/base.apk!libncnn.so (offset 0x1ef6000) (ncnn::Net::load_param(ncnn::DataReader const&)+84) (BuildId: 1627564bc24cb9cf2a9a20614562ab216f573104)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #06 pc 000000000011fb64 /data/app/~~u26UCHHl8zUeRe1CIUegZQ==/com.-GChOU2ts_v4A7wLG3B-W7w==/base.apk!libncnn.so (offset 0x1ef6000) (ncnn::Net::load_param(AAssetManager*, char const*)+84) (BuildId: 1627564bc24cb9cf2a9a20614562ab216f573104)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #07 pc 0000000000037e98 /data/app/~~u26UCHHl8zUeRe1CIUegZQ==/com.-GChOU2ts_v4A7wLG3B-W7w==/base.apk!libsherpa-ncnn-core.so (offset 0x24b0000) (sherpa_ncnn::Model::Create(AAssetManager*, sherpa_ncnn::ModelConfig const&)+120) (BuildId: 5e505e3f16211698ffa61dd79d0703ecd58ed228)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #08 pc 0000000000040c64 /data/app/~~u26UCHHl8zUeRe1CIUegZQ==/com.-GChOU2ts_v4A7wLG3B-W7w==/base.apk!libsherpa-ncnn-core.so (offset 0x24b0000) (sherpa_ncnn::Recognizer::Impl::Impl(AAssetManager*, sherpa_ncnn::RecognizerConfig const&)+280) (BuildId: 5e505e3f16211698ffa61dd79d0703ecd58ed228)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #09 pc 000000000003c570 /data/app/~~u26UCHHl8zUeRe1CIUegZQ==/com.-GChOU2ts_v4A7wLG3B-W7w==/base.apk!libsherpa-ncnn-core.so (offset 0x24b0000) (sherpa_ncnn::Recognizer::Recognizer(AAssetManager*, sherpa_ncnn::RecognizerConfig const&)+48) (BuildId: 5e505e3f16211698ffa61dd79d0703ecd58ed228)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #10 pc 0000000000002e5c /data/app/~~u26UCHHl8zUeRe1CIUegZQ==/com.-GChOU2ts_v4A7wLG3B-W7w==/base.apk!libsherpa-ncnn-jni.so (offset 0x2504000) (Java_com_k2fsa_sherpa_ncnn_SherpaNcnn_newFromAsset+172) (BuildId: 7cec1bd501a3fe051d7d547fd4a93d3c5939e0e2)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #11 pc 0000000000351e30 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 4801adadf1dae7e020ba05f3204efc9c)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #12 pc 00000000005b98b0 /apex/com.android.art/lib64/libart.so (nterp_helper+4016) (BuildId: 4801adadf1dae7e020ba05f3204efc9c)
2024-04-09 15:15:37.923 30179-30179 DEBUG pid-30179 A #13 pc 000000000043b6f0 /data/app/~~u26UCHHl8zUeRe1CIUegZQ==/com.-GChOU2ts_v4A7wLG3B-
@nihui 可以帮忙看下吗?
@KennyHuangChina 你用的是最新的代码么?
大概是几个月前的,最近有更新吗?有 fix 相关的问题?我去看看 commit history
请用最新的 master 测试
再贴一下上面的 log
RecognizerConfig(feat_config=FeatureExtractorConfig(sampling_rate=16000, feature_dim=80),
model_config=ModelConfig(
encoder_param="sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/encoder_jit_trace-pnnx.ncnn.param",
encoder_bin="sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/encoder_jit_trace-pnnx.ncnn.bin",
decoder_param="sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/decoder_jit_trace-pnnx.ncnn.param",
decoder_bin="sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/decoder_jit_trace-pnnx.ncnn.bin",
joiner_param="sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/joiner_jit_trace-pnnx.ncnn.param",
joiner_bin="sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/joiner_jit_trace-pnnx.ncnn.bin",
tokens="sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/tokens.txt", encoder num_threads=2,
decoder num_threads=2, joiner num_threads=2),
decoder_config=DecoderConfig(method="greedy_search", num_active_paths=4), endpoint_config=Endpoi
用的文件是
noCompress
编译,可以解决问题Asset
方式,改用 LocalFile
方式初始化,也可以解决问题经过测试通过上面的方法可行。多谢 @csukuangfj @KennyHuangChina
该问题提供了同样的编译好了的apk文件,亲测可行:https://github.com/csukuangfj/sherpa-ncnn/releases/tag/disable-asset-compression
- 用
noCompress
编译,可以解决问题- 将 模型文件,从 Asset copy 到 APP 沙盒,不用
Asset
方式,改用LocalFile
方式初始化,也可以解决问题
请问大佬,我也是这个问题,但是我在build.gradle中加上如下配置,却依然闪退是怎么回事啊
android {
...
aaptOptions {
noCompress 'assets'
}
}
你用我们提供的apk,有问题否。如果有,请告诉我们你是如何下载我们提供的apk
该问题提供了同样的编译好了的apk文件,亲测可行:https://github.com/csukuangfj/sherpa-ncnn/releases/tag/disable-asset-compression
我用这个apk,没有问题,我把对应的 source code 下下来,在里面没有看到禁止压缩 assets 的选项,请问您是怎么编译的呢
- 用
noCompress
编译,可以解决问题- 将 模型文件,从 Asset copy 到 APP 沙盒,不用
Asset
方式,改用LocalFile
方式初始化,也可以解决问题请问大佬,我也是这个问题,但是我在build.gradle中加上如下配置,却依然闪退是怎么回事啊
android { ... aaptOptions { noCompress 'assets' } }
我将配置做了修改,编译后可以成功运行,非常感谢 @csukuangfj
android { ... aaptOptions { noCompress '' } }
@zqyp 看你在另外一个 issue 里的评论,发现你已经解决了。太棒啦!
问题出在这行上。 是不是编译出的东东无法在这种天玑 展锐的机器上跑? 需要怎么编译?
init { if (assetManager != null) { ptr = newFromAsset(assetManager, config) } else { ptr = newFromFile(config) } }
错误异常:
Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7c39e34000 in tid 23665 (fsa.sherpa.ncnn), pid 23665 (fsa.sherpa.ncnn) 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A Softversion: PD2055B_A_8.13.2 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A Time: 2024-03-24 12:58:44 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A Build fingerprint: 'vivo/PD2055/PD2055:13/TP1A.220624.014/compiler11091453:user/release-keys' 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A Revision: '0' 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A ABI: 'arm64' 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A Timestamp: 2024-03-24 12:58:44.046797201+0800 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A Process uptime: 31s 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A Cmdline: com.k2fsa.sherpa.ncnn 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A pid: 23665, tid: 23665, name: fsa.sherpa.ncnn >>> com.k2fsa.sherpa.ncnn <<< 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A uid: 10267 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x0000007c39e34000 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A x0 b400007c39e0c7a0 x1 b400007c39e33fe0 x2 6170726568530a36 x3 0000000000000000 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A x4 0000000000000000 x5 0000000000000000 x6 607360436073644c x7 7f7f7f7f7f7f7f7f 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A x8 0**1 x9 0000000000000004 x10 0000007fee1f5cc0 x11 ffffff80ffffffd0 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A x12 0000007fee1f5b50 x13 0000000000000001 x14 0000000000000000 x15 0000007eed9d1812 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A x16 0000007eeda75d88 x17 0000007eed9f7b40 x18 0000007f102ca000 x19 ffffffffffffffff 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A x20 b400007c697e5fd0 x21 0000007f0f274000 x22 b400007c697e5fd0 x23 0000007f0f274000 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A x24 0000007fee1f6510 x25 0000007f0f274000 x26 0000007f0f274000 x27 0000000000000003 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A x28 0000007fee1f65c0 x29 0000007fee1f5ab0 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A lr 0000007eeda2aad0 sp 0000007fee1f5ab0 pc 0000007eed9f7be0 pst 0000000060001000 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A backtrace: 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A #00 pc 000000000004bbe0 /apex/com.android.runtime/lib64/bionic/libc.so (__strlen_aarch64+160) (BuildId: cbc4256ea6b3c4acdd12a421256d7f6e) 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A #01 pc 000000000007eacc /apex/com.android.runtime/lib64/bionic/libc.so (__strlen_chk+20) (BuildId: cbc4256ea6b3c4acdd12a421256d7f6e) 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A #02 pc 00000000000a2808 /apex/com.android.runtime/lib64/bionic/libc.so (vsscanf+136) (BuildId: cbc4256ea6b3c4acdd12a421256d7f6e) 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A #03 pc 00000000000b5360 /apex/com.android.runtime/lib64/bionic/libc.so (sscanf+120) (BuildId: cbc4256ea6b3c4acdd12a421256d7f6e) 2024-03-24 12:58:44.151 24000-24000 DEBUG pid-24000 A #04 pc 0000000000109f5c /data/app/~~GuP-h8_2vKAStTSEZ5fQVA==/com.k2fsa.sherpa.ncnn-9L6u2E6wtPgcBUYfi-IEDA==/lib/arm64/libncnn.so (ncnn::DataReaderFromAndroidAsset::scan(char const, void) const+164) (BuildId: 120e011fb24b042fee4d4c9d5a8106e743625072) 2024-03-24 12:58:44.152 24000-24000 DEBUG pid-24000 A #05 pc 00000000001148ec /data/app/~~GuP-h8_2vKAStTSEZ5fQVA==/com.k2fsa.sherpa.ncnn-9L6u2E6wtPgcBUYfi-IEDA==/lib/arm64/libncnn.so (ncnn::Net::load_param(ncnn::DataReader const&)+84) (BuildId: 120e011fb24b042fee4d4c9d5a8106e743625072) 2024-03-24 12:58:44.152 24000-24000 DEBUG pid-24000 A #06 pc 0000000000117ed0 /data/app/~~GuP-h8_2vKAStTSEZ5fQVA==/com.k2fsa.sherpa.ncnn-9L6u2E6wtPgcBUYfi-IEDA==/lib/arm64/libncnn.so (ncnn::Net::load_param(AAssetManager, char const)+84) (BuildId: 120e011fb24b042fee4d4c9d5a8106e743625072) 2024-03-24 12:58:44.152 24000-24000 DEBUG pid-24000 A #07 pc 000000000003a62c /data/app/~~GuP-h8_2vKAStTSEZ5fQVA==/com.k2fsa.sherpa.ncnn-9L6u2E6wtPgcBUYfi-IEDA==/lib/arm64/libsherpa-ncnn-core.so (sherpa_ncnn::Model::Create(AAssetManager, sherpa_ncnn::ModelConfig const&)+120) (BuildId: a0f98d011401c3dc0de238d2af864d2ab137b045) 2024-03-24 12:58:44.152 24000-24000 DEBUG pid-24000 A #08 pc 0000000000042630 /data/app/~~GuP-h8_2vKAStTSEZ5fQVA==/com.k2fsa.sherpa.ncnn-9L6u2E6wtPgcBUYfi-IEDA==/lib/arm64/libsherpa-ncnn-core.so (sherpa_ncnn::Recognizer::Impl::Impl(AAssetManager, sherpa_ncnn::RecognizerConfig const&)+272) (BuildId: a0f98d011401c3dc0de238d2af864d2ab137b045) 2024-03-24 12:58:44.152 24000-24000 DEBUG pid-24000 A #09 pc 000000000003dd14 /data/app/~~GuP-h8_2vKAStTSEZ5fQVA==/com.k2fsa.sherpa.ncnn-9L6u2E6wtPgcBUYfi-IEDA==/lib/arm64/libsherpa-ncnn-core.so (sherpa_ncnn::Recognizer::Recognizer(AAssetManager*, sherpa_ncnn::RecognizerConfig const&)+48) (BuildId: a0f98d011401c3dc0de238d2af864d2ab137b045) 2024-03-24 12:58:44.152 24000-24000 DEBUG pid-24000 A #10 pc 0000000000002c20 /data/app/~~GuP-h8_2vKAStTSEZ5fQVA==/com.k2fsa.sherpa.ncnn-9L6u2E6wtPgcBUYfi-IEDA==/lib/arm64/libsherpa-ncnn-jni.so (Java_com_k2fsa_sherpa_ncnn_SherpaNcnn_newFromAsset+172) (BuildId: cf4bc21817aed6d528bcd0cbc4eaa3bdc998cea4) 2024-03-24 12:58:44.152 24000-24000 DEBUG pid-24000 A #11 pc 000000000021a354 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: cacff818afb569b5000b4cdc1347b805) 1970-01-01 08:00:00.000 0-0 I ---------------------------- PROCESS ENDED (23665) for package com.k2fsa.sherpa.ncnn ----------------------------