Installation
FileKit can helps you to display dialogs to the user like file, directory and photo pickers, save dialogs, camera and more. FileKit dialogs are available in two flavors:PlatformFile support.
Platform-specific setup
It’s required to setup FileKit Dialogs on Android and JVM targets. All other platforms are supported out of the box.Android setup
Using needs an initialization step in your Android application.This initialization step is not needed when using filekit-dialogs-compose.
ActivityResultRegistry to handle the result of the file picker dialog. To do this, you need to add the following code to your MainActivity:
MainActivity.kt
JVM setup
FileKit needs to have your application id to handle the app directory. Your application id is generally the package name or the name of your application. FileKit will use thisappId as app directory.
We recommend you to initialize FileKit in your main.kt file:
main.kt
- Windows:
%APPDATA%\your.application.id\ - macOS:
~/Library/Application Support/your.application.id/ - Linux:
~/.local/share/your.application.id/
Custom Cache and Data Directories
For applications that need custom directory paths (e.g., portable applications or specific deployment scenarios), you can specify custom cache and data directories:main.kt
ProGuard Configuration
If you’re using ProGuard or code obfuscation on JVM platforms, add the relevant rules to yourproguard-rules.pro:
Linux setup
If using JVM target and Linux distribution, you need to add the following module in yourbuild.gradle.kts file:
build.gradle.kts
NoClassDefFoundError in some cases. Read more about this issue in the GitHub issue #107.
If using the Kotlin/Native Linux target (linuxX64 or linuxArm64), dialogs are provided out of the box through the GNOME XDG Desktop Portal. The portal file chooser is shown on systems running xdg-desktop-portal (default on GNOME and other modern desktops); the application binary links against the libdbus-1 runtime library.
Building an application that consumes FileKit Dialogs requires the target architecture’s D-Bus development libraries (libdbus-1-dev on Debian/Ubuntu), including the unversioned libdbus-1.so linker file. If the library directory is outside Kotlin/Native’s linker search paths, configure the corresponding target, for example:
pkg-config --variable=libdir dbus-1 on a native Linux build machine). Cross-compilation requires libraries for the target architecture. Running the finished application requires the runtime library, not the development package.
Building filekit-dialogs from source for Linux native targets requires the Linux D-Bus development headers (libdbus-1-dev on Debian/Ubuntu). Linux builds discover them through pkg-config. For cross-compilation, pass -Pfilekit.dbusHeaders=/path/to/include, where include/dbus/ contains both the public headers and the Linux dbus-arch-deps.h. Release and snapshot workflows supply these headers to the macOS build so both Linux artifacts and their multiplatform metadata are published together.