Skip to content

Building from source

Devesh Rai edited this page Oct 21, 2026 · 1 revision

Building from source

Requirements

  • JDK 17 or later. Android Studio's bundled JDK works.
  • Android SDK with platform 37 (compile SDK) and build tools. Point local.properties at it with sdk.dir=…; Android Studio does this for you.
  • Gradle comes with the wrapper; the build uses AGP 9.4 and Kotlin 2.4.

Build and install

git clone https://github.com/deveshrai/Foldman.git
cd Foldman
./gradlew :app:assembleDebug
adb install -r app/build/outputs/apk/debug/Foldman-*-debug.apk

With no extra setup, local music and YT Music work fully, and Apple Music runs by driving the Apple Music app. To stream Apple Music inside Foldman, see Apple Music and MusicKit.

Trying the postures without a foldable

Create a foldable emulator, then switch its hinge from the command line:

avdmanager create avd -n foldman_fold -k "system-images;android-36;google_apis;arm64-v8a" -d pixel_9_pro_fold
emulator -avd foldman_fold
adb shell cmd device_state state 0   # folded: the cover screen
adb shell cmd device_state state 2   # open
adb shell cmd device_state state 1   # half-open; rotate to landscape for Flex mode

Project layout

app/src/main/java/dev/foldman/
  MainActivity.kt          hinge tracking, folder picker, sign-in launcher
  deck/                    DeckViewModel (transport state machine), shared models
  playback/                local music: library scan, Media3 service, artwork, VU levels
  remote/                  other apps' media sessions (YT Music, Apple Music app)
  apple/                   MusicKit bridge, Apple Music API, crash-isolated player service
  ui/                      Compose UI: cassette, keys, gauges, panels, layouts
art/icon.svg               launcher icon source
tools/                     token and icon generators
docs/media/                README images and GIFs

Regenerating the icon

Edit art/icon.svg (it's drawn on Android's 108-unit adaptive-icon grid), then run:

python3 tools/svg_to_icon.py

This rewrites the foldman_icon_* layers in res/drawable/. They aren't named ic_launcher_* on purpose: MusicKit's auth AAR contains Android Studio's template robot under that name, and it would replace Foldman's icon.

Clone this wiki locally