You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android调用System.loadLibrary加载so库报UnsatisfiedLinkError找不到libchilkat.so

Android加载native库找不到so文件问题处理

问题描述

调用System.loadLibrary()加载native库时持续报错,错误信息如下:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xxxxxxxxxxxxxxxxx/base.apk"],nativeLibraryDirectories=[/data/app/com .xxxxxxxxxxxxxxxxx/lib/arm64, /system/lib64, /product/lib64]]] couldn't find "libchilkat.so"

涉及的Java加载代码:

static {
    System.loadLibrary("chilkat");
}

解决方法

问题已通过如下操作解决:

  • 把Android Studio默认生成在<Project>\app\libs路径下的libs文件夹,移动到<Project>\app\src\main\路径下
  • 在模块级build.gradle配置文件中添加如下配置:
android {
  ....
      sourceSets {
      main.jniLibs.srcDirs = ['libs']
          }
     }

调整完成后重新编译运行,so库即可正常加载。

内容的提问来源于stack exchange,提问作者HTL CO

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 07:15:03