Build GPSTest app with Android Studio

The GPSTest app is currently (December 2024) not available to most devices on the Google Play store due to the app temporarily being configured for a too-old minimum Android version. This is a security measure enforced by Google Play store to all apps to preserve security of devices. App stores of other operating systems enforce similar restrictions for security.

A workaround until the GPSTest app authors update the app configuration is to build and install the app using Android Studio. Android Studio is free to use and works on Windows, macOS, or Linux equally well. Default settings were used, including setting up an optional emulator. Any reasonably current Android Studio version should be suitable.

This method doesn’t make any changes to the app, but bypasses the Google Play store restrictions by building and installing GPSTest directly from the laptop onto an Android phone. An inconvenience is lack of easy app distribution as every phone needs to one-time plug into a laptop with USB-C to install the GPSTest app. If the phone isn’t detected, try another USB cable as some cables are power-only and don’t have data lines. A message will popup on the phone asking to authorize the laptop to connect in USB Debugging mode. The app can be used indefinitely after the one-time plugin and install.

Download and Build GPSTest

Use Git as in any other project from the Terminal:

git clone https://github.com/barbeau/gpstest

From Android Studio, open that “gpstest” directory from “File > Open” menu.

Try to build the app with the “Build > Make Project” menu – or click the hammer icon in the upper right toolbar of Android Studio. Failures like

Unknown Kotlin JVM target: 21

may result upon building. This stems from the default JVM version in Android Studio. For repeatability, it is typical across code languages and platforms to have a project manifest specifying exact library versions. Android apps manifests are typically “build.gradle” file(s). We don’t edit the manifest at this time, because maybe we’ll break something unexpectedly in the app. Instead, set Android Studio to use JVM 17 as specified by manifest file “GPSTest/build.gradle”:

compileOptions {
   sourceCompatibility JavaVersion.VERSION_17
   targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
   jvmTarget = JavaVersion.VERSION_17
}

This is accomplished under Android Studio’s Settings icon (geared wheel) in the upper right corner of the Android Studio main window. Select “Build, Execution, Development > Build Tools > Gradle” in the left hand Settings panel. Under “Gradle Projects” in the right panel, “Gradle JDK” may be set to 21 or so. Select in that menu to “Download JDK and selection “Amazon Coretto 17” or JetBrains 17 or similar. This will take a couple minutes to download and install, then click OK.

Again try to build the app with the “Build > Make Project” menu – or click the hammer icon. There will be a number of warnings, but the app should build successfully. If the optional emulator is present, clicking “Run > Run GPSTest” or clicking the green right arrow in the top Android Studio menu bar will run the app in the emulator.

Connecting Phone

The phone needs to have Developer Mode enabled to upload apps from Android Studio. Under Developer Mode settings, USB Debugging needs to be enabled, at least for the brief time the phone is connected to the laptop to upload the app. If this is a personal phone, consider disabling USB Debugging at all other times to help the security of the phone from physical hacking (someone steals/takes the phone and wants to break into it). In Android Studio Device Manager, clicking “+” will add the phone, or it may appear automatically. Clicking the Android Studio “Run” green arrow will install the app automatically if the physical phone is selected in Android Studio Device Manager. After the app is installed, unplug USB at any time and turn off USB Debugging under the phone’s Developer Mode settings if desired.

GPSTest Caveats

Android 14 and newer will not have the “Share” icon at the top of GPSTest app due to enhanced security in Android 14. The GPSTest maintainers will need to update the GPSTest app to work fully with newer Android versions.