3.3 Generating the Application Package (APK)

In Android Studio, click on the Build menu then “Build APK”. If there were no errors, this should produce app/release/app-release.apk (in Android Studio 2024+). You should rename this file to a more descriptive name like tangram-1.0.0.apk.

Alternatively from the command line, run the following commands:

./gradlew assembleRelease

This will produce an unsigned APK in app/build/outputs/apk/release/app-release-unsigned.apk. To sign this, you will need to locate the build tools for the version specified in app/build.gradle under android.buildToolsVersion (if present; otherwise the most recent build tools supported by the Android Gradle plugin). You will also need to know where the keystore of your app signing key is located.

${BUILD_TOOLS_VERSION_DIRECTORY}/apksigner sign \
  --alignment-preserved \
  --ks ${ANDROID_KEYSTORE} --ks-key-alias ${SIGNING_KEY_ALIAS} \
  --out app/${APP_NAME}-${VERSION}.apk \
  app/build/outputs/apk/release/app-release-unsigned.apk

(The --alignment-preserved option may be needed if you are using build tools 35 or higher.)