[Android] Fatal crash on SanaSession.initNative - MNN Chat 0.8.3 (P0)
Description
When attempting to use the MNN-Sana-Edit-V2 model (Ghibli-style image transformation), the app crashes immediately with UnsatisfiedLinkError. The model downloads successfully, but loading the Sana session fails.
Environment
· App Version: 0.8.3 · Device: Xiaomi Redmi Note11t pro (xaga) · Android Version: 14 · Model: ModelScope/MNN/MNN-Sana-Edit-V2
Crash Log
java.lang.UnsatisfiedLinkError: No implementation found for long com.alibaba.mnnllm.android.llm.SanaSession.initNative(java.lang.String, java.lang.String) (tried Java_com_alibaba_mnnllm_android_llm_SanaSession_initNative and Java_com_alibaba_mnnllm_android_llm_SanaSession_initNative__Ljava_lang_String_2Ljava_lang_String_2) - is the library loaded, e.g. System.loadLibrary?
at com.alibaba.mnnllm.android.llm.SanaSession.initNative(Native Method)
at com.alibaba.mnnllm.android.llm.SanaSession.load(SanaSession.kt:42)
at com.alibaba.mnnllm.android.chat.ChatPresenter$load$1.invokeSuspend(ChatPresenter.kt:153)Full crash log: [attach crash log file or pastebin link]
Analysis
- Root Cause: UnsatisfiedLinkError - SanaSession.initNative JNI method not found. System.loadLibrary loads the MNN core library successfully (JNI_OnLoad is called normally), but the Native implementation for SanaSession is not registered. This suggests libmnnllm.so is missing Sana/Diffusion related symbols.
- Version Status: The current APK version is 0.8.3, but the server-side main_config.json returns latest_version as 0.8.2.2 (version number regression). This may affect the update detection logic.
- Reproduces Previous Confirmed Issue: This matches the previously confirmed CMake build configuration issue in version 0.8.3, where Sana/Diffusion related JNI and Session source files were omitted from the Android build. We have verified that pulling the latest source code and rebuilding resolves the issue. However, the currently distributed APK still appears to be an old build artifact that does not include the fix.
Suggested Fix
· Please repackage and release a new APK (e.g., 0.8.4 or higher) that includes the fix for the CMake build configuration. · Please update the latest_version field in main_config.json to match the new release version, avoiding version number regression.
Additional Context
· The model (MNN-Sana-Edit-V2) downloads successfully and is recognized as a local model (isLocal: true), but loading it triggers the crash. · The update checker compares 0.8.3 (current) against 0.8.2.2 (server), which is an inversion.
——————————————
问题定位:
- 崩溃根因:UnsatisfiedLinkError - SanaSession.initNative JNI 方法缺失。System.loadLibrary 已成功加载 MNN 核心库(JNI_OnLoad 正常),但 SanaSession 对应的 Native 实现未注册,推测 libmnnllm.so 中缺少 Sana/Diffusion 相关符号。
- 版本状态:当前 APK 版本号为 0.8.3,但服务端配置 main_config.json 返回的 latest_version 为 0.8.2.2,版本号倒挂,建议同步更新服务端配置。
- 构建问题复现:该问题与您此前确认的 0.8.3 版本 CMake 构建配置遗漏 Sana/Diffusion 源文件一致(SanaSession.initNative 缺失)。我们已拉取最新源码验证修复有效,但当前分发渠道的 APK 仍为旧构建产物,未包含该修复。
- 建议: · 请重新打包发布包含修复的 0.8.4 或更高版本 APK; · 同步更新 main_config.json 中的 latest_version 字段,避免版本号倒挂影响更新检测逻辑。
译文由AI生成,不一定100%准确。
Source: alibaba/MNN