Generating APK from source code
Steps how to generate APK from source code

Source Code references

Open Terminal and clone source code git clone https://github.com/Sunbird-Saral/Project-Saral.git
ReferSource Code Repositoryfor latest repository location.
Change Directory to Project-Saral/ folder and switch to release tag as per release notes. git checkout tags/<tag_name>
$FRONTEND_FOLDER = Project-Saral/v1.0/frontend
$BACKEND_FOLDER = Project-Saral/v1.0/backend

Saral v1.0 Android App bundling/packaging

  1. 1.
    Follow Frontend Setup steps @ Workspace Setup - Playbook​
  2. 2.
    Implementing Saral App for specific purpose , its recommended to change default package com.saralapp references to implementation specific package for example com.saralapp.xxstate for xxstate. Refer below screenshot.
  3. 3.
    Open Terminal in $FRONTEND_FOLDER/SaralApp/android folder
./gradlew clean
  1. 1.
    APK Signing can be enabled using the below Gradle files. Make sure the Keystore file is to be used for signing placed in $FRONTEND_FOLDER/SaralApp/android/app folder.
​$FRONTEND_FOLDER/SaralApp/android/gradle.properties
1
MYAPP_RELEASE_STORE_FILE=my-upload-key.keystore
2
​
3
MYAPP_RELEASE_STORE_PASSWORD=changeit
4
​
5
MYAPP_RELEASE_KEY_ALIAS=hwrecog-key-alias
6
​
7
MYAPP_RELEASE_KEY_PASSWORD=changeit
Copied!
​$FRONTEND_FOLDER/SaralApp/android/app/build.gradle
Note: Make sure signingConfig signingConfigs.release the line is uncommented.
1
signingConfigs {
2
release {
3
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
4
storeFile file(MYAPP_RELEASE_STORE_FILE)
5
storePassword MYAPP_RELEASE_STORE_PASSWORD
6
keyAlias MYAPP_RELEASE_KEY_ALIAS
7
keyPassword MYAPP_RELEASE_KEY_PASSWORD
8
​
9
// Optional, specify signing versions used
10
v1SigningEnabled true
11
v2SigningEnabled true
12
}
13
}
14
debug {
15
storeFile file('debug.keystore')
16
storePassword 'android'
17
keyAlias 'androiddebugkey'
18
keyPassword 'android'
19
}
20
}
21
​
22
buildTypes {
23
debug {
24
signingConfig signingConfigs.release
25
}
26
release {
27
signingConfig signingConfigs.release
28
debug {
29
debuggable true
30
}
31
}
32
}
Copied!
  1. 1.
    Update google-services.json file in $FRONTEND_FOLDER/SaralApp/android/app folder.
  2. 2.
    Open Terminal in $FRONTEND_FOLDER/SaralApp/android folder
./gradlew assembleRelease
(OR)
./gradlew assembleDebug
3. You can find the release apk file in Project-Saral/v1.0/frontend/SaralApp/android/app/build/outputs/apk/release or debug folder.
Note: If releasing APK file for a client/implementation, its recommended to build APK from the release tag and modify implementation-specific BASE_URL entry and google-services.json file.
  1. 1.
    Open terminal from $FRONTEND_FOLDER/SaralApp/android folder and execute the below command to verify apk signature.
jarsigner -verbose -verify ./app/build/outputs/apk/release/app-release.apk