Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

1 Setup

thorbenkuro edited this page Feb 1, 2022 · 8 revisions

CWA Android Setup Guide

This guide explains the process of setting up Android Studio to build the Corona-Warn-App and installing it on an android emulator running on your computer. When you build the app this way, you cannot activate exposure logging, because the Exposure Notification API blocks you from doing this unless you are whitelisted inside GMS. For further information on this topic, you can take a look here.

1. Download and install Android Studio

Download the latest version from Android Studio here: https://developer.android.com/studio. Install it using the “Standard” installation type. You can follow this official guide to get step by step instructions on how to install Android Studio: https://developer.android.com/studio/install

2. Install Android SDK Version 30

The Android SDK Platform 30 is needed to build the app. To check if you have the necessary SDK platform installed go to Tools > SDK Manager. When you open Android Studio for the first time, you can access the SDK Manager from the welcome screen by clicking on More options… > SDK Manager. Under the SDK Platforms Tab check the “Show Package Details”-box in the lower right corner, to see more specific installation options. In the detailed list you can check if the Android SDK Platform 30 (Android 11.0 (R)) is installed. If it is not installed, select the Android SDK Platform 30 and click OK to install it. Follow the installation wizard to successfully install the SDK.

3. Download the sourcecode

You can download the source code for the app by navigating to the code section on this repository and clicking on ‘code > download zip’ or by cloning the repository.

4. Import the project into Android Studio

After you downloaded the source code, you must import the project into Android Studio. You can do this by opening Android Studio and clicking on ‘File > Open…’ and choosing the folder, that contains the downloaded source code. Wait for Android Studio to configure Gradle and download the additional files, that are needed to build the project. The status of this initialization is shown in the right corner of the bottom toolbar.

5. Set Gradle Build JDK (if not automatically done)

Make sure, that the selected version of your Gradle Build jdk is at least version 11. By default recent versions of Android Studio come with JDK11, that works fine for building the app (except for Apple M1 users), but if you run into any issues when building the app, check your JDK version.

We strongly advice Mac-Users with an Apple M1 based processor to download and use a separate JDK11, that is built for the x86 architecture and runs on Rosetta2. The JDK11, that is bundled with Android Studio for Macs with M1 based chips runs natively on the ARM-processor. This causes errors during the build process, because some of the dependencies do not support ARM-processors and the build fails.

To set your Gradle Build JDK open the Corona-Warn-App project in Android Studio and go to Preferences. In the Build, Execution, Deployment > Build Tools section click on Gradle and choose an appropriate Gradle JDK on this page.

6. Set the Build Variant

Make sure, that the Build Variant deviceForTestersDebug for the Corona-Warn-App module is selected. To set the Build Variant go to Build > Select Build Variant... and click on the active Build Variant to choose deviceForTestersDebug.

7. Create a virtual device (optional)

If you want to run the app on an emulator on your computer, you must create a virtual device using the AVD Manager. You can follow this official guide for step-by-step instructions: https://developer.android.com/studio/run/managing-avds

8. Build and install the android app

  • To build and install the app on the selected virtual-device, click on the run button in the top toolbar. The build process can take up to 10 minutes, depending on your hardware.
  • To only build the apk file, click on the Make Project icon in the top toolbar. The build process can take up to 10 minutes, depending on your hardware.

Troubleshooting

If you have problems building the app, clean the build files, as this might already solve your problem:

  • Linux/MacOS: Navigate to the project root-folder and run ./gradlew clean
  • Windows: Navigate to the project root-folder and run gradlew clean