Build script to cross-compile rsync for Android.
armv7a, aarch64, i686 and x86_64 Android binaries compiled under GitHub Actions are available as release assets from this repository.
There is a JAR release asset containing all of the binaries (renamed to librsync.so to allow them to be executed from within an Android app). This is also available as a package for ease of use as a dependency in Android Studio.
- Ensure that the Android NDK is located at
$ANDROID_NDK_HOME
or$ANDROID_HOME/ndk-bundle
. - Run
./build
From an Android app with the published package added as a dependency:
val libDir = context.applicationInfo.nativeLibraryDir
val args = ArrayList<String>()
args.add("$libDir/librsync.so")
args.add("--version")
val builder = ProcessBuilder(args)
val rsync = builder.start()
val result = rsync.waitFor()
val stdout = rsync.inputStream.bufferedReader().use(BufferedReader::readText)
val stderr = rsync.errorStream.bufferedReader().use(BufferedReader::readText)
Log.d(TAG, "Exit code: $result")
Log.d(TAG, "Standard out: $stdout")
Log.d(TAG, "Standard error: $stderr")
For a full example, you can check out the source of my Rsync for Tasker app.