Community Health Toolkit

Generated apks not compatible with android 8 or lower

Describe the Bug
After resolving this problem, Issues generating apks from cht-android code base - #3 by Kymoraa, I successfully managed to generate the release and debug apks for a new brand. However, these apks are only compatible with Android v10 and v11. {Not tested on v9). The apks have not successfully installed on devices running version 5, 7, 8 and also on Android GO.

Should the apks be compatible with these lower versions?
Most of our CHWs have v8 devices.

How To Reproduce The Issue

Install the generated apk on an Android device on v8 or lower

Error Message

There was a problem parsing the package



  • Android devices
  • Version: 5, 7, 8, Android GO

Hey, we do support running on the older versions. Down to Android 4.4. As of Android 10 we started building two versions of the application to support the older devices. One is using Webview and the other is using Crosswalk(a bundled version of chrome).

Can you share the command you ran to build your apks?

To build the apk for the older devices. You would need to ensure the flavour has the engine of Xwalk.

make flavor=UnbrandedXwalk would build the unbranded version of the application using crosswalk.

Thank you for your response @Nick
I sequentially ran the following commands to get to my generated apk. {I did not use crosswalk}

  1. make org=new_brand keygen
  2. make org=new_brand keyprint
  3. make org=new_brand flavor=New_brandWebview assemble
  4. make keyprint-apk
  5. make org=new_brand flavor=New_brandWebview bundle
  6. make keyprint-bundle

About Java 8, the current version of cht-android as pointed out by @Kymoraa needs to be built with Java 11. We ended support to Java 8 because the LTS period ended (except you paid Oracle for extended support) or use unsupported flavors, but mostly because Java 11 is required to use the latest version of the Android plugin from Google, needed to build the app.

This not affect the versions of devices supported though, the build plugin takes care of lowering the targeted version of Java when compiling for older devices, and if a feature from the Java SDK is used that cannot be translated to older versions, the build fails.

Thank you @mrsarm
So, what does this mean for us exactly?
How will we be able to make the application compatible with devices running Android Version 8 and below?

To make and distribute the App for the whole range of supported devices, take a look to the Android App Bundles section, and the following section “APKs”.

Thank you very much @Nick and @mrsarm, I was able to create the apks that work with Android versions 4-9

1 Like