把语音合成的SDK,库放到源码上编译,出现联网时语音合成正常,关掉网络后,出现离线合成错误的问题,LOG如下:
JNI DETECTED ERROR IN APPLICATION: JNI NewByteArray called with pending exception 'java.lang.NoSuchMethodError' thrown in int com.baidu.tts.jni.EmbeddedSynthesizerEngine.bdTTSSynthesis(long, byte[], int):-2
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] in call to NewByteArray
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] from int com.baidu.tts.jni.EmbeddedSynthesizerEngine.bdTTSSynthesis(long, byte[], int)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] "EngineExecutorPoolThread(1)" prio=5 tid=19 Runnable
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] | group="main" sCount=0 dsCount=0 obj=0x12ded280 self=0xb7f50ee0
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] | sysTid=4709 nice=0 cgrp=default sched=0/0 handle=0xa3c41000
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] | state=R schedstat=( 121505617 61300151 118 ) utm=11 stm=1 core=1 HZ=100
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] | stack=0xa2044000-0xa2046000 stackSize=1036KB
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] | held mutexes= "mutator lock"(shared held)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #00 pc 00004fcc /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #01 pc 00247af5 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream >&, int, char const*, art::mirror::ArtMethod*)+68)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #02 pc 0022c2f9 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream >&) const+144)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #03 pc 000b0681 /system/lib/libart.so (art::JniAbort(char const*, char const*)+560)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #04 pc 000b0dbb /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+58)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #05 pc 000b3e49 /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1276)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #06 pc 000bc0a1 /system/lib/libart.so (art::CheckJNI::NewByteArray(_JNIEnv*, int)+20)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #07 pc 0000194d /system/lib/libbdtts.so (callback_audio+64)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #08 pc 00064669 /system/lib/libbd_etts.so (bd_tts_callback_output_data(char const*, int, char)+200)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #09 pc 00054b7d /system/lib/libbd_etts.so (bd_vocoder(DMatrixClass*, DVectorClass*, globalP*, _HTS_Vocoder*, callback_wav_output*)+756)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #10 pc 000496f1 /system/lib/libbd_etts.so (SpeechSynthesis_callback+352)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #11 pc 00049c69 /system/lib/libbd_etts.so (Pdf2Speech_block(int, TUTTERANCE*, _SynModel*, int&, int&, short*, int*)+368)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #12 pc 00049ddb /system/lib/libbd_etts.so (Pdf2Speech+86)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #13 pc 00046adb /system/lib/libbd_etts.so (hts_engine+86)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #14 pc 00060a21 /system/lib/libbd_etts.so (bd_tts_session_get_audio(long, unsigned char*, unsigned int*, _TAG_TTS_TEXT_STATE*)+604)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #15 pc 00060b89 /system/lib/libbd_etts.so (???)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #16 pc 00060ccb /system/lib/libbd_etts.so (???)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #17 pc 00061f67 /system/lib/libbd_etts.so (bd_etts_synthesis+18)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #18 pc 00001b41 /system/lib/libbdtts.so (Java_com_baidu_tts_jni_EmbeddedSynthesizerEngine_bdTTSSynthesis+36)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] native: #19 pc 00000a53 /data/dalvik-cache/arm/system@priv-app@GtLauncher@GtLauncher.apk@classes.dex (Java_com_baidu_tts_jni_EmbeddedSynthesizerEngine_bdTTSSynthesis__J_3BI+142)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] at com.baidu.tts.jni.EmbeddedSynthesizerEngine.bdTTSSynthesis(Native method)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] - locked <0x08749d1a> (a java.lang.Class)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] at com.baidu.tts.b.a.b.e$b.a(OfflineSynthesizer.java:160)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] at com.baidu.tts.b.a.b.e.a(OfflineSynthesizer.java:94)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] at com.baidu.tts.b.a.b.d.a(MixSynthesizer.java:196)
07-23 16:49:54.973: A/art(4551): art/runtime/check_jni.cc:70] at com.baidu.tts.b.a.a.c$a.a(EngineExecutor.java:233)
07-23 16:49:54.974: A/art(4551): art/runtime/check_jni.cc:70] at com.baidu.tts.b.a.a.c$a.call(EngineExecutor.java:213)
07-23 16:49:54.974: A/art(4551): art/runtime/check_jni.cc:70] at java.util.concurrent.FutureTask.run(FutureTask.java:237)
07-23 16:49:54.974: A/art(4551): art/runtime/check_jni.cc:70] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
07-23 16:49:54.974: A/art(4551): art/runtime/check_jni.cc:70] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
07-23 16:49:54.974: A/art(4551): art/runtime/check_jni.cc:70] at java.lang.Thread.run(Thread.java:818)
07-23 16:49:54.974: A/art(4551): art/runtime/check_jni.cc:70]
Log上面显示NoSuchMethodError,请问是你们库的BUG吗
https://m.biomart.cn/experiment/s?type=2&wd=%E7%BC%85%E7%94%B8%E6%9E%9C%E5%8D%9A%E4%B8%9C%E6%96%B9%E8%B5%8C%E5%9C%BA%E5%BC%80%E6%88%B7%E5%BC%80%E6%88%B7TL262.c%EF%BC%AF%EF%BC%AD%E8%AF%9A%E4%BF%A1%E5%8D%9A%E5%A4%A9%E4%B8%8B%EF%BC%BE%EF%BC%A5 https://b2b.baidu.com/s?q=%E7%BC%85%E7%94%B8%E5%8D%8E%E7%BA%B3%E5%9B%BD%E9%99%85%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%E7%BD%91%E5%9D%80TL262.%EF%BC%A3%EF%BC%AF%EF%BC%AD%E9%98%9C%E6%96%B0%E8%81%94%E9%80%9A%EF%BC%81%EF%BD%8A%EF%BC%94&from=search http://pro.baidu.com/new/home/search/search?keyword=%E7%8E%89%E5%92%8C%E5%9B%BD%E9%99%85%E5%A8%B1%E4%B9%90%E5%BE%AE%E4%BF%A1%E5%BC%80%E6%88%B7%E7%94%B5%E8%AF%9D%E4%BB%A3%E7%90%86%E5%92%A8%E8%AF%A2%E5%AE%98%E7%BD%91B2024%EF%BC%8E%EF%BC%A3N%E8%8D%86%E9%97%A8%E6%8B%9B%E8%81%98%EF%BD%87%EF%BC%BE%EF%BD%8F&type=all https://mod.3dmgame.com/mods?mods_title=%E6%96%B0%E7%99%BE%E8%83%9C%E5%A8%B1%E4%B9%90%E5%BC%80%E5%8F%B7%E5%BE%AE%E4%BF%A1%E3%80%90%E5%AE%98%E7%BD%91%E2%86%92TL262%C2%B7C%EF%BC%AFM%E3%80%91%E9%93%B6%E5%B7%9D%E6%AF%95%E4%B8%9A%E7%94%9F%EF%BD%81%EF%BD%99 https://unsplash.com/s/photos/%E6%9E%9C%E6%95%A2%E8%85%BE%E9%BE%99%E5%9B%BD%E9%99%85%E7%94%B5%E8%AF%9D%E7%BD%91%E6%8A%95%E5%BC%80%E6%88%B7TL262%C2%B7C%EF%BC%AFM%E6%B2%88%E9%98%B3%E6%AF%95%E4%B8%9A%E7%94%9F%EF%BD%85
请你检查打包和运行时so库的加载是否正常,从你的log看好像是你的so库没有加载成功导致没有找到方法。