spaceforge / ANDROID.md
2Btainment's picture
feat(android): bake SDK in Docker; return debug APK from download (zip fallback)
dbc2744 verified
|
Raw History Blame Contribute Delete
1.8 kB

SpaceForge — Android (Capacitor) MVP

Artifact shipped

Preferred Debug APK (.apk) when Android SDK + JDK are in the SpaceForge Docker image
Fallback Capacitor 6 Android project ZIP if APK build fails / SDK missing
Mode Hosted Wrapper (Hybrid runtime — WebView loads live Space URL)
Unsigned Debug APK is unsigned (sideload / adb install); not Play Store release
Converter backend/app/converters/mobile/android.py + finalize.py

Compatibility badges (UI)

  • ✓ project — Capacitor + Gradle scaffold generated
  • ✓ APK included — when assembleDebug succeeds inside SpaceForge
  • ⚠ APK not built — fallback project zip only
  • ✗ GPU local impossible — when Space needs GPU; inference stays on Hugging Face

What the user installs

  1. Analyze Space → select Android (Capacitor) → Build → Download.
  2. If filename ends with .apk: transfer to a device and sideload (adb install -r app.apk or Files → install). Allow unknown sources if prompted.
  3. If filename ends with .zip (fallback): unzip → npm install → npx cap sync android → Android Studio / ./scripts/build-android.sh.

Labeling rules

  • Never call the Hosted Wrapper a “Local offline APK” of the model/GPU runtime.
  • Correct: “Debug APK (Hosted Wrapper / WebView)” or “project zip fallback”.
  • binary_included / apk_included are true only when a real .apk file is returned.

Docker image

The Space Dockerfile bakes:

  • OpenJDK 17, Node 20, Android cmdline-tools
  • platforms;android-34, build-tools;34.0.0
  • Optional Gradle warmup via scripts/docker_warmup_android.sh

Env: ANDROID_HOME=/opt/android-sdk, SPACEFORGE_ANDROID_BUILD_TIMEOUT=900.