Task 2: Generate the Android application package (APK)

Step 1: Prepare a machine that meets the following requirements and make sure it has Internet access.

The machine must be installed with the following software and hardware configurations:

  • Windows 7/8/10 (32-bit or 64-bit) or Mac OS X 10.10 thru 10.14

  • 4 GB RAM minimum

  • 2 GB of available disk space minimum

Step 2: Download the Android Studio setup program from here, and then install Android Studio by following instructions here. The machine must have Internet access to complete the installation.

By the time of writing this document, the most current version is Android Studio 3.5.3. This version requires SDK Build Tools 28.0.3 or higher and Gradle 5.4.1 or higher.

Step 3: Open the Android project generated in Task 1: from Android Studio, select the project folder to load the entire project.

Step 4: In Android Studio, open the build.gradle file and get the required versions for SDK and build tools.

For Android Studio 3.5.3, the SDK must be version 28, and the build tools must be version 28.0.3.

Figure 55. build.gradle

build.gradle

Step 5: Select Tools | SDK Manager from the menu, and then install the required SDK and build tools.

In the SDK Platforms tab, select Android 9.0 (28).

Figure 56. SDK platforms

SDK platforms

In the SDK Tools tab, select Android SDK Build-Tools 28.0.3.

Figure 57. SDK tools

SDK tools

Click OK to begin install.

Step 6: Configure the version of the Android Gradle plugin and the Gradle.

The version of Android Gradle plugin required by Android 3.5.3 is 3.5.3, and the version of Gradle required by Android Gradle plugin 3.5.3 is 5.4.1. If the Android Studio is not version 3.5.3, make sure you change the versions of Android Gradle plugin and Gradle correspondingly.

The following lines set the plugin to version 3.5.3 in the build.gradle file:

dependencies {
  classpath 'com.android.tools.build:gradle:3.5.3'
}

The following line sets the Gradle to version 5.4.1 in the gradle/wrapper/gradle-wrapper.properties file:

...
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
...

Step 7: Select the build type (debug or release) in the Build Variants window (to open the Build Variants window, select View | Tool Windows | Build Variants from the menu.

Figure 58. SDK tools

SDK tools

Step 8: Build the APK file by selecting Build | Build Bundle(s) / APK(s) | Build APK(s) from the menu.

Make sure the machine has Internet access during the build process.