Add Android support via Tauri
The Rust core was already portable (caller-provided db paths, rustls rather
than openssl) and the shell already had the mobile entry point, so this is
mostly toolchain, provisioning, and platform-gating.
Toolchain:
- scripts/android-setup.sh installs what Android Studio doesn't: SDK
cmdline-tools, a pinned stable NDK, and the Rust Android targets. The NDK is
pinned rather than "latest" because sdkmanager's newest is often a beta
(30.0.15729638 is r30-beta2) -- not something to compile SQLite with. Prefers
Android Studio's bundled JDK 21, since Gradle rejects newer JDKs.
- Track src-tauri/gen/android (excluding build output): AndroidManifest.xml is
hand-edited and Android permissions have no tauri.conf.json equivalent.
- vite: serve on TAURI_DEV_HOST so a device/emulator can reach the dev server.
Card data: downloading streams ~740MB to build a ~73MB db, which is rough on a
phone. Add import_reference_db to adopt a desktop-built file instead, validated
by db::inspect_reference_db first so picking the wrong file is a clean error
rather than a broken install. Installs via copy-then-rename so an interrupted
copy can't leave a partial db.
Ingest hardening (helps desktop too):
- Give ureq connect/read timeouts. Cancellation is only polled per parsed
record, so a stalled socket previously hung forever with no way to cancel.
- Drop the remove_file before rename; POSIX rename already replaces atomically,
and the delete-first window could leave no reference.db at all if the process
was killed -- much likelier on Android.
UI: hide Open/New Library on mobile (scoped storage has no arbitrary-path
equivalent, and SQLite can't open a content:// URI), reported via a cfg!(mobile)
flag on Status rather than user-agent sniffing. Use 100dvh so the soft keyboard
doesn't break the shell.
Verified: 70/70 core tests, desktop build clean, and the aarch64 APK builds
(bundled SQLite C and ring both cross-compile under NDK 28). Not yet run on a
device.
2026-08-02 13:16:34 -05:00
|
|
|
# Project-wide Gradle settings.
|
|
|
|
|
# IDE (e.g. Android Studio) users:
|
|
|
|
|
# Gradle settings configured through the IDE *will override*
|
|
|
|
|
# any settings specified in this file.
|
|
|
|
|
# For more details on how to configure your build environment visit
|
|
|
|
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
|
|
|
# Specifies the JVM arguments used for the daemon process.
|
|
|
|
|
# The setting is particularly useful for tweaking memory settings.
|
|
|
|
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|
|
|
|
# When configured, Gradle will run in incubating parallel mode.
|
|
|
|
|
# This option should only be used with decoupled projects. More details, visit
|
|
|
|
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
|
|
|
# org.gradle.parallel=true
|
|
|
|
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
|
|
|
|
# Android operating system, and which are packaged with your app"s APK
|
|
|
|
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
|
|
|
android.useAndroidX=true
|
|
|
|
|
# Kotlin code style for this project: "official" or "obsolete":
|
|
|
|
|
kotlin.code.style=official
|
|
|
|
|
# Enables namespacing of each library's R class so that its R class includes only the
|
|
|
|
|
# resources declared in the library itself and none from the library's dependencies,
|
|
|
|
|
# thereby reducing the size of the R class for that library
|
|
|
|
|
android.nonTransitiveRClass=true
|
2026-10-16 22:39:36 -05:00
|
|
|
android.nonFinalResIds=false
|
|
|
|
|
|
|
|
|
|
# From Tauri's Gradle 9 template: plugin crates ship consumer-rules.pro
|
|
|
|
|
# references that don't exist, and still use the pre-AGP-9 Kotlin setup.
|
|
|
|
|
android.proguard.failOnMissingFiles=false
|
|
|
|
|
android.builtInKotlin=false
|
|
|
|
|
android.newDsl=false
|