How to build for Android
Install tools
Get and install the Java Development Kit
Download the Android Studio/SDK command line tools (scroll to the bottom to find packages with only the command line tools).
Unpack the command line tools, e.g. into
$HOME/cmdline-tools/latestAdd the
cmdline-tools's parent folder to the environment variableANDROID_HOME, and the/bin-folder toPATH:# in .bashrc or similar export ANDROID_HOME="$HOME/.android" export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$PATH"Check for updates:
sdkmanager --updateInstall build tools:
sdkmanager --install "build-tools;34.0.0"
Build for Android
Clone the repo as described in Get started
Navigate to
seedlingo/appRun the build command
npm run build:androidFind the final
.apk-file inandroid/app/build/outputs/apk/release/.
Troubleshooting
Must have Java JDK installed
Check with:
javac --version
Install with:
sudo apt install openjdk-21-jdk-headless
Java and gradle versions must sync
Verify that gradle version is in sync with java version (see the Gradle Compatibility Matrix).
Update seedlingo/app/android/gradle/wrapper/gradle-wrapper.properties accordingly, e.g. set distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip for javac --version -> 21.0.4:
# at [...]/seedlingo/app/android
./gradlew wrapper --gradle-version 8.9
# if successful, repeat
./gradlew wrapper --gradle-version 8.9
Running the command twice ensures that the updated version is working correctly on the second run.
Warning
The version of the Android Gradle plugin (AGP) and Gradle itself are not the same version number. Check compatibility at Android Gradle Plugin > Update Gradle
Optional extras
Sign the .apk bundle
- Add an
apksign.keystorefile (see the Android Studio documentation) to~/.androidand run the build commandnpm run build:androidagain.
Splash and icons
Update splash image and icons
npx cordova-res android --skip-config --copy --icon-source public/logo-m/apple-touch-icon-512x512.png --splash-source public/logo/splash.png --icon-foreground-source public/logo/icon-foreground.png --icon-background-source public/logo/icon-background.png`Edit
ic_launcher.xmlandic_launcher_round.xml, swapbackground's@colorto@mipmap