OpenSRP android client app build

Note: OpenSRP App build depends on Server build, so please complete that before building app

  1. Clone OpenSRP app git repository from https://github.com/OpenSRP/opensrp-client using git clone https://github.com/OpenSRP/opensrp-client
  2. Android Emulator
    1. Default Emulator: Create, for the first time, and start an Android Virtual Device by using android avd with API level 16 and screen resolution 1024 X 600
    2. Genymotion: Alternatively, you can also install Genymotion Android Emulator which is much faster than the default Android emulator.
      1. Install Genymotion emulator
      2. Install Virtual Box
      3. Follow ARM Translation instructions to get OpenSRP app working on Genymotion
      4. Start Genymotion emulator and create a Virtual device with API level 16 and screen resolution 1024 X 600
  3. Install gradle, you can obtain it from the Gradle home page (http://gradle.org/). 

Login (for demo server):

login-username - demotest, login-password - Demot123

Check app.properties file in "drishti-app/asset/" folder to change the demo server url to your own instance of opensrp server.

Building and Running from terminal : 

source : http://developer.android.com/tools/building/building-cmdline.html

  1. Build App
    1. Debug Mode
      1. Windows : gradlew.bat assembleDebug
      2. Mac Os and Linux : ./gradlew assembleDebug
    2. Release Mode
      1. Windows : gradlew.bat assembleRelease
      2. Mac Os and Linux : ./gradlew assembleRelease

  2. Running the App

    1. Apk file can be found in opensrp-app/build/outputs/apk
    2. Install the apk to emulator/device.
  3. Unit Test
    1. Debug Mode : gradlew testArmDebug
      test report : opensrp-app/build/reports/tests/armDebug/index.html 
    2. Release Mode : gradlew testArmRelease
      test report : opensrp-app/build/reports/tests/armRelease/index.html
    3. All Mode : gradlew test
  4. Integration Test
    1. Debug Mode : gradlew connectedAndroidTestArmDebug
      test report : opensrp-app/build/reports/androidTests/connected/flavors/arm/index.html 

Building and Running from Android Studio :

source : http://developer.android.com/tools/building/building-studio.html

  1. Build App
    To build the project on Android Studio, click Build and select Make Project
  2. Running the App
    1. Create run configuration
      1. Click "Run -> Edit Configurations"
      2. Select "+" from the upper left corner and select Android Application
      3. Add a name for the configuration
      4. Set module to opensrp-app
    2. Run the configuration
  3. Unit Test
    1. Open the "Build variants" tool window (on the left) and change the test artifact to "Unit tests".
    2. Create test configuration
      1. Click "Run -> Edit Configurations"
      2. Select "+" from the upper left corner and select Junit
      3. Add a name for the test
      4. Set "Test kind" to "All in package" if you want to test all the files in the package. Set module to opensrp-app.
      5. Important : Replace working directory value to "$MODULE_DIR$"
    3. Run the test configuration
  4. Integration Test
    1. Open the "Build variants" tool window (on the left) and change the test artifact to "Android Instrumentation Tests".
    2. Create test configuration
      1. Click "Run -> Edit Configurations"
      2. Select "+" from the upper left corner and select "Android Tests"
      3. Add a name for the test
      4. Set module to opensrp-app
    3. Run the test configuration