CommCare is an easily customizable, open source mobile platform that supports frontline workers in low-resource settings. By replacing paper-based forms, frontline workers can use CommCare to track and support their clients with registration forms, checklists, SMS reminders, and multimedia.

This repository represents the Android version of CommCare. It depends on the CommCare Core repository, which contains the XForm engine and case/lookup table implementations.


To set up an Android dev environmnet for commcare-android, do the following:

Go ahead and open Android Studio if this is your first time using it; it may take you through some sort of setup wizard, and it's nice to get that out of the way.

Android Studio's default project space is ~/AndroidStudioProjects so I'm going to use that in the example. CommCare Android depends on CommCare Core, and CommCare Android expects the core directory to live side by side in your directory structure. You can acheive this with the following commands (in bash):

cd ~/AndroidStudioProjects
mkdir CommCare
cd CommCare
git clone
git clone


Now you're basically ready to go. To build CommCare Android and get it running on your phone, plug in an android phone that

In Android Studio, hit the build button (a green "play" symbol in the toolbar). The first build will take a minute. Then it'll ask you what device to run it on


Building from the command-line

CommCare has several different build variants. The normal build variant is commcare and can built built from the command-line with the following command:

cd commcare-android
./gradlew assembleCommcareDebug
# the apk can now be found in the build/outputs/apk/ directory


The commcare-android repository uses Robolectric, which provides mocks, allowing you to run Android specific code on your local machine.

Run tests from the command-line

cd commcare-android
./gradlew testCommcareDebug

and view the results from the output file generated.

Run tests from Android Studio

Create a new Android Studio JUnit Build configuration using the following steps.

Code Style Settings

In order to comply with code style guidelines we follow, please use Commcare Coding Style file and Commcare Inspection Profile as your respective code style and inpection profile in Android Studio. To do so follow these instructions

  1. Copy the config files to your Android Studio installation as follows (Replace AndroidStudio3.0 with the respective directory for the AS version you are using) -
cp .android_studio_settings/inspection/CommCare\ Inpsection\ Profile.xml ~/Library/Preferences/AndroidStudio3.0/inspection/.

cp .android_studio_settings/codestyles/CommCare\ Coding\ Style.xml ~/Library/Preferences/AndroidStudio3.0/codestyles/.  
  1. Restart Android Studio

  2. Go to AS preferences -> Editor -> Code Style and select Scheme as 'Commcare Coding Style' and to AS preferences -> Editor -> Inspections and select Profile as 'Commcare Inspection Profile'

Common Errors

If you experience the following exception when running the tests: Illegal key size or default parameters

you will need to upgrade the JCE policy files that are being used. To do so:

  1. Download the JCE Unlimited Strength policy files for Java 8 (Last we checked they could be found here, but this can change
  2. Find the java home directory on your machine. On mac you can do so by entering the following into the command line: echo $(/usr/libexec/java_home)
  3. From there, cd into jre/lib/security, and replace the local_policy.jar and US_export_policy.jar files found there with the ones in the zip file you downloaded

NOTE that if you are running the tests from Android Studio, it may be using a different version of Java than that in your java home directory. The first line of the test output will usually show the directory from which Android Studio is running Java (Usually /Applications/Android If it is indeed different, you should follow the steps above for that directory as well.

If you experience the following exception when running individual tests from Android Studio Editor on Mac

No such manifest file: build/intermediates/bundles/debug/AndroidManifest.xml

If you are on a Mac, you will probably need to configure the default JUnit test runner configuration in order to work around a bug where IntelliJ / Android Studio does not set the working directory to the module being tested. This can be accomplished by editing the run configurations, Defaults -> JUnit and changing the working directory value to $MODULE_DIR$

Error on attempt to install CommCare app on phone: Unknown failure during app install

Android Monitor in Android Studio shows the following exceptions:

java.lang.RuntimeException: CommCare ran into an issue deserializing data while inflating type
Caused by: org.javarosa.core.util.externalizable.DeserializationException:
No datatype registered to serialization code [4b a9 e5 89]