Where to Put the Chilkat JNI Shared Libraries (Android)
On Android, the native JNI library (libchilkat.so) must be
placed so it's packaged into your APK under the correct ABI (architecture) folder. This
page shows where the files go and how to avoid the common
UnsatisfiedLinkError.
Where the .so files go in your project
The Chilkat Android download contains one libchilkat.so per ABI under
libs/. In an Android Studio project, copy each into the matching ABI folder
under app/src/main/jniLibs/:
app/src/main/jniLibs/ ├─ arm64-v8a/ libchilkat.so ├─ armeabi-v7a/ libchilkat.so ├─ x86/ libchilkat.so └─ x86_64/ libchilkat.so
When you build, Gradle automatically packages these into the APK under the
lib/<abi>/ folder, and Android loads the one matching the device's
architecture at runtime. (Keep the ABI folder names exactly as shown.)
Which ABIs to include
| ABI folder | Used by |
|---|---|
arm64-v8a | 64-bit ARM — nearly all modern devices (required for Google Play) |
armeabi-v7a | Older 32-bit ARM devices |
x86_64 | 64-bit x86 emulators (and some Chromebooks) |
x86 | 32-bit x86 emulators |
Include every ABI you intend to support. At minimum, include arm64-v8a for
real devices; add x86_64 if you run the x86 emulator. You can restrict the
packaged ABIs in build.gradle:
android {
defaultConfig {
ndk {
abiFilters "arm64-v8a", "armeabi-v7a", "x86_64"
}
}
}
Load the library in code
Load the native library once before using any Chilkat class — pass the name
without the lib prefix or .so extension:
// e.g. in a static initializer or Application.onCreate System.loadLibrary("chilkat");
Troubleshooting UnsatisfiedLinkError
-
Confirm the .so is in the APK
An
.apkis a ZIP archive — open it and check thatlib/<abi>/libchilkat.sois present for the device's architecture. -
Match the device's ABI
Make sure you included the ABI the device/emulator uses (most physical devices are
arm64-v8a). If you setabiFilters, confirm it lists that ABI. -
Check the library name
The name passed to
System.loadLibrarymust be"chilkat"— not"libchilkat"or"libchilkat.so". -
Read logcat
Run
adb logcatto see the exact reason the library failed to load.