Skip to content

F-Droid Preparation

Ark is being prepared for F-Droid. The blocking architecture work is done: the Android project is committed source, Ark has standard/fdroid distribution flavors, and Google ML Kit is excluded from the F-Droid dependency graph. The remaining work before submission is a real fdroidserver scanner and build pass.

What Is In The Repo Now

  • Android package ID: pt.rgo.ark
  • Android versionCode: 1, versionName: 1.0.0
  • FOSS license: MIT (root and every local modules/* package)
  • Committed android/ project generated by expo prebuild (flavors standard/fdroid)
  • Fastlane metadata under fastlane/metadata/android/en-US/
  • Draft fdroiddata metadata under fdroid/metadata/pt.rgo.ark.yml
  • No Firebase, Google Mobile Services, ads, or analytics packages in package.json
  • Repository hygiene check (bun run check:repo) rejects committed Gradle caches and binaries

Distribution Flavors

The Android project defines two flavors on a distribution dimension:

  • standard — GitHub/Play build. ABI-split APKs, Google ML Kit image/PDF OCR enabled.
  • fdroid — F-Droid build. One universal APK, ML Kit excluded, OCR reports a typed unsupported result so the UI labels it instead of attempting it.

Build commands:

sh
bun run android:build:prod   # assembleStandardRelease (GitHub release APKs)
bun run android:build:dev    # assembleStandardDebug
bun run android:build:fdroid # assembleFdroidRelease -ParkAbiSplits=false -ParkDistribution=fdroid

F-Droid Build Recipe

The recipe in fdroid/metadata/pt.rgo.ark.yml builds the fdroid variant with:

  • ARK_DISTRIBUTION=fdroid env for the JS bundle and autolinking, so the on-device AI runtimes (react-native-executorch, llama.rn, @react-native-ai/llama) are shimmed out of the JS bundle and excluded from native autolinking (react-native.config.js), then scandeleted from the source tree.
  • -ParkDistribution=fdroid so modules/ark-ocr drops Google ML Kit.
  • -ParkAbiSplits=false for one universal APK.
  • scripts/fdroid-prepare.sh installs the pinned Bun (1.3.3) from its npm package and runs bun install --frozen-lockfile. Ark keeps bun.lock because npm cannot apply the patchedDependencies (tentap-editor, uniwind).
  • Reduced Gradle heap via ARK_GRADLE_XMX_MB / ARK_GRADLE_WORKERS.

Validate locally:

sh
bun run android:build:fdroid   # ARK_DISTRIBUTION=fdroid assembleFdroidRelease
fdroid readmeta && fdroid lint --format pt.rgo.ark

Scanner Status

A local fdroidserver 2.4.5 scanner run over the full source + node_modules found ~438 findings. All are prebuilt artifacts in node_modules (Expo SDK local-maven-repo AAR/JAR, react-native/Hermes, Skia, MapLibre, valhalla-mobile, kiwix, llama.rn, ExecuTorch) plus the ML Kit coordinate string in modules/ark-ocr/android/build.gradle and its node_modules copy. The metadata's directory-scoped scanignore set covers the known cross-platform surface; the exact set must be reconciled on the F-Droid Linux build server (macOS-only artifacts like fsevents and @esbuild/darwin are absent there, and unused scanignore paths are errors). Keep entries narrow; do not add a broad scanignore: node_modules.

ML Kit Removal

modules/ark-ocr depends on com.google.mlkit:text-recognition (proprietary) for image and scanned-PDF OCR. It is excluded from the F-Droid graph via the arkDistribution project property:

  • modules/ark-ocr/android/build.gradle gates the ML Kit dependency behind if (arkDistribution != 'fdroid') and selects either src/standard/java (ML Kit engine) or src/fdroid/java (unsupported-OCR stub).
  • The shared module keeps PDF text-layer extraction (PDFBox, Apache-2.0) and reports getCapabilities() per build so JavaScript can label OCR availability.
  • src/config/capabilities.ts exposes getArkCapabilities(); the document screen disables the OCR action and explains why on F-Droid builds.

F-Droid Constraints That Matter For Ark

F-Droid requires public source code, a FOSS license, FOSS dependencies, command-line buildability, and store metadata. React Native apps need extra scanner work because JavaScript dependencies can contain prebuilt .jar, .aar, or .so artifacts.

References:

Expected Scanner Hot Spots

  • llama.rn prebuilt native artifacts and @react-native-ai/llama duplication
  • ExecuTorch native artifacts (imported unconditionally in app/_layout.tsx)
  • MapLibre native dependencies
  • Skia prebuilt native libraries
  • valhalla-mobile routing library (prebuilt AAR from Maven Central)
  • ArkZim and CoreKiwix/libkiwix artifacts

These may be acceptable if they are FOSS and traceable, but F-Droid packaging will need precise scanignore, scandelete, or source-build adjustments after scanner output is available. Do not add a broad scanignore: node_modules.

Likely Submission Flow

  1. Cut a tagged Android release candidate and replace TODO_TAG_FOR_FIRST_FDROID_RC in the metadata.
  2. Run the recipe on the F-Droid build server (GitLab pipeline), reconcile the scanignore set with the Linux output, and remove disable: once fdroid build succeeds.
  3. Verify the F-Droid APK on a physical device (fresh install, maps, routing, ZIM, PDF text extraction, notes, backups, background location).
  4. Submit a merge request to fdroiddata after the exact recipe builds from a clean clone.

Possible F-Droid Flavor Work

The fdroid flavor already excludes Google ML Kit and the local AI runtimes (ExecuTorch, llama.rn). If scanner output rejects other optional native dependencies (Skia, routing, ZIM), extend the same env-driven pattern (JS shims + react-native.config.js exclusions + scandelete) while keeping maps, guides, notes, backups, tools, and imported documents working. Do this only from actual scanner evidence.

Ark is beta software. Verify critical information with official sources and field training.