# Build Melo from source These instructions are for contributors and people who want to build Melo themselves. Most users should install the signed APK from [GitHub Releases](https://github.com/aarush-io/melo/releases/latest). ## Requirements - JDK 21 - Android SDK Platform 37 and Build Tools 36.0.0 or newer - Android NDK 27.0.12077973 and CMake 3.22.1, from the SDK Manager (Gradle installs them if the SDK licences are accepted) - An internet connection on the first build: CMake downloads Oboe and libusb, pinned by SHA-256 in `app/src/main/cpp/CMakeLists.txt` The native code is AutoMix's analyser and loop mixer (`native/analyzer`, `native/loopmix`) and the bit-perfect USB output (`app/src/main/cpp`). It is built for every Android ABI. The APK contains no native Spotify runtime. AutoMix's models run on ONNX Runtime from `app/libs/onnxruntime-android-1.28.0-automix.aar`, the official AAR with a runtime reduced to the operators the models use. `native/onnxruntime/build.sh` rebuilds it on Linux or WSL; see the comments at its top. The models themselves are not in the APK: the app downloads them from the `automix-models` release when AutoMix is first turned on. Firebase Analytics is only compiled in when `app/google-services.json` exists. The live listener count is only sent when the build sets `-PmeloStatsEndpoint=https:///api/presence`. ## Windows Clone the repository and configure the Android SDK using `ANDROID_HOME` or an ignored `local.properties` file. Build and package the signed release: ~~~powershell .\gradlew.bat :app:assemblePhoneRelease :app:assembleTvRelease -PmeloUpdateRepository=aarush-io/melo powershell -NoProfile -ExecutionPolicy Bypass -File scripts/package-release.ps1 powershell -NoProfile -ExecutionPolicy Bypass -File scripts/package-release.ps1 -Tv ~~~ The `phone` flavour is the phone, tablet and car app (`in.melo`). The `tv` flavour is the Android TV app (`in.melo.tv`), which installs beside it and updates from its own `Melo-TV-v.apk` release asset. The APK, SHA-256 checksum, and signing-certificate report are written to the ignored `dist` folder. Create the Melo signing key once with `scripts/create-signing-key.ps1` and back up the ignored `.signing` directory securely. Never commit the signing key or its properties file. ## macOS and Linux Use `./gradlew` with the same Gradle property and packaging script. ## Development build ~~~powershell .\gradlew.bat :app:assemblePhoneDebug :app:testPhoneDebugUnitTest ~~~ ## Playback implementation notes Spotify supplies metadata only: catalogue, library and playlists. Every track, Spotify ones included, plays from YouTube Music (`ytm://` addresses read by `YouTubeDataSource`) or from a local file. The protocol notes distinguish static checks, tests with doubles, and validation against live services. A moving playhead or a populated buffer is not proof of audible playback; check decoded audio after seeks and across track changes.