[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4 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/app-release.apk’ (in Android Studio 2.3) or ‘app/release/app-release.apk’ (in Android Studio 2024). You should rename this file to a more descriptive name like ‘notepad-1.3.1.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 is needed if you are using build tools 35 or higher.)


This document was generated on March 27, 2025 using texi2html 5.0.