Development guide

A guide to developing the CardScan SDK and using some of its more advanced features.


Code Organization

The CardScan SDK is built from multiple android modules, each of which builds upon more base modules. The structure of the modules used in CardScan looks like this:

module structure

The CardScan SDK consists of these modules as well as a demo app:


The scan-framework module contains the framework used to scan images. See the architecture document for details on how it processes images from the camera.


The scan-camera module contains the camera interfaces for setting up the camera on the device and receiving images from it. It also handles converting the images from the camera to a processable format.


The scan-payment module contains the code for validating and managing payment cards.


The scan-ui module contains some common functionality shared between user interfaces for scanning cards. This provides the card viewfinder, debug overlay, and base scan activity.


The cardscan-ui module builds on top of the scan-ui and scan-payment modules to provide user interfaces for scanning payment cards. Anything specific to the user interface of the CardScan product lives in this library.


The cardscan-demo app provides a demonstration for launching the CardScan SDK as a separate activity and for integrating the CardScan library into an existing activity.


Check out the project using git.

git clone

To build the project, run the following command:

./gradlew build

To create an AAR release of the app, run the following command:

./gradlew assembleRelease

This will place an AAR file in cardscan-ui/build/outputs/aar


These libraries follow a standard github contribution flow.

  1. Create a new github feature branch

    git checkout -b <your_github_name>/<your_feature_name>
  2. Make your code changes

  3. Push your branch to origin

    git push --set-upstream origin <your_branch_name>
  4. Create a new pull request on github, and tag appropriate owners.

  5. Once you have approval, merge your branch into master and delete your feature branch from github.

Running Unit Tests

Unit tests can be run from android studio or from the command line. To execute from the command line, run the following command:

./gradlew test

Running Android Tests

Android tests can be run from android studio or from the command line. To execute from the command line, run the following command:

./gradlew connectedAndroidTest

Note that these tests require that you have an emulator running or a physical device connected to your machine via ADB.


See the release documentation.