DroidFS relies on modified versions of the original encrypted filesystems programs to open volumes. CryFS is written in C++ while gocryptfs is written in Go. Thus, building DroidFS requires the compilation of native code. However, for the sake of simplicity, the application has been designed in a modular way: you can build a version of DroidFS that supports both gocryptfs and CryFS, or only one of the two.
Moreover, DroidFS aims to be accessible to as many people as possible. If you encounter any problems or need help with the build, feel free to open an issue, a discussion, or contact me (currently the main developer) by email or on Matrix: @hardcoresushi:matrix.underworld.fr
Install the required packages:
For Debian-based Linux distributions:
$ sudo apt-get install openjdk-17-jdk-headless build-essential pkg-config git gnupg2 wget npm
For Arch Linux and derivatives:
$ sudo pacman -S jdk17-openjdk gcc make patch pkgconf git gnupg wget npm
If you want support for gocryptfs volumes, you also need to install Go:
On Debian:
$ sudo apt-get install golang-go
On Arch:
$ sudo pacman -S go
Package names might be similar for other distributions. Don't hesitate to ask if you're having trouble with this.
Then, you have to install the Android SDK using the sdkmanager command line tool. You DON'T need to install Android Studio to build an Android app! Android Studio is an infamous bloatware bundled with trackers that will be more useful for consuming your entire RAM and heating your house than for building any piece of software.
You can follow this guide to setup sdkmanager, but basically it should be:
$ export ANDROID_HOME="<PATH>" <-- choose any path you like as the location of the Android SDK installation
$ mkdir -p "$ANDROID_HOME/cmdline-tools"
$ unzip -d "$ANDROID_HOME/cmdline-tools" commandline-tools-*.zip
$ cd "$ANDROID_HOME/cmdline-tools"
$ mv cmdline-tools latest
Then, install the Android Native Development Kit (NDK) version 28.2.13676358 (r28c):
$ "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" 'ndk;28.2.13676358'
$ export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/28.2.13676358"
libcryfs cannot be built with newer NDK versions at the moment due to compatibility issues with boost. If you succeed in building it with a more recent version of the NDK, please report it.
The source code should be authenticated before being built. To verify the signatures, you will need my PGP key:
$ gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys AFE384344A45E13A
Fingerprint: B64E FE86 CEE1 D054 F082 1711 AFE3 8434 4A45 E13A
Email: Hardcore Sushi <hardcore.sushi@disroot.org>
Download DroidFS source code:
$ git clone --depth=1 https://tangled.org/cipherd.arkensys.dedyn.io/DroidFS
Verify sources:
$ cd DroidFS
$ git verify-commit HEAD
Don't continue if the verification fails!
Initialize submodules:
$ git submodule update --init
If you want gocryptfs support, initialize libgocryptfs submodules:
$ cd app/libgocryptfs
$ git submodule update --init
If you want CryFS support, initialize libcryfs submodules:
$ cd app/libcryfs
$ git submodule update --init
If you know your CPU ABI, you can specify it to build scripts in order to speed up compilation time. If you don't know it, or want to build for all ABIs, just leave the field empty.
Start by compiling FFmpeg:
$ cd app/ffmpeg
$ ./build.sh [<ABI>]
This step is only required if you want gocryptfs support.
$ cd app/libgocryptfs
$ ./build.sh [<ABI>]
Gradle build libgocryptfs and libcryfs by default.
To build DroidFS without gocryptfs support, run:
$ ./gradlew assembleRelease [-Pabi=<ABI>] -PdisableGocryptfs=true
To build DroidFS without CryFS support, run:
$ ./gradlew assembleRelease [-Pabi=<ABI>] -PdisableCryFS=true
If you want to build DroidFS with support for both gocryptfs and CryFS, just run:
$ ./gradlew assembleRelease [-Pabi=<ABI>]
If the build succeeds, you will find the unsigned APKs in app/build/outputs/apk/release/. These APKs need to be signed in order to be installed on an Android device.
If you don't already have a keystore, you can create a new one by running:
$ keytool -genkey -keystore <output file> -alias <key alias> -keyalg EC -validity 10000
Then, sign the APK with:
$ "$ANDROID_HOME/build-tools/37.0.0/apksigner" sign --out DroidFS-signed.apk -v --ks <keystore> app/build/outputs/apk/release/<unsigned apk file>
Now you can install DroidFS-signed.apk on your device.