Comment on page
Generating APK from source code
Steps how to generate APK from source code
Open Terminal and clone source codegit clone https://github.com/Sunbird-Saral/Project-Saral.git
Change Directory toProject-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
- 1.
- 2.Implementing Saral App for specific purpose , its recommended to change default package
com.saralapp
references to implementation specific package for examplecom.saralapp.xxstate
for xxstate. Refer below screenshot. - 3.App Icon can be customised/replaced by generating App icon using standard icon editors and replace icons in below folders.
- $FRONTEND_FOLDER\SaralApp\android\app\src\main\res\mipmap-mdpi
- $FRONTEND_FOLDER\SaralApp\android\app\src\main\res\mipmap-hdpi
- $FRONTEND_FOLDER\SaralApp\android\app\src\main\res\mipmap-xhdpi
- $FRONTEND_FOLDER\SaralApp\android\app\src\main\res\mipmap-xxhdpi
- $FRONTEND_FOLDER\SaralApp\android\app\src\main\res\mipmap-xxxhdpi
- 4.
./gradlew clean
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.MYAPP_RELEASE_STORE_FILE=my-upload-key.keystore
MYAPP_RELEASE_STORE_PASSWORD=changeit
MYAPP_RELEASE_KEY_ALIAS=hwrecog-key-alias
MYAPP_RELEASE_KEY_PASSWORD=changeit
Note: Make sure
signingConfig signingConfigs.release
the line is uncommented. Also set enableSeparateBuildPerCPUArchitecture
flag to true to generate CPU architecture specific APKs. This will also reduce the size of the APK compared to universal APK.
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
// Optional, specify signing versions used
v1SigningEnabled true
v2SigningEnabled true
}
}
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.release
}
release {
signingConfig signingConfigs.release
/* These are optional params to shrink the app size*/
shrinkResources enableProguardInReleaseBuilds
zipAlignEnabled enableProguardInReleaseBuilds
useProguard enableProguardInReleaseBuilds
minifyEnabled enableProguardInReleaseBuilds
minifyEnabled true
shrinkResources true
/* These are optional params to shrink the app size*/
debug {
debuggable true
}
}
}
- 1.
- 2.Edit
$FRONTEND_FOLDER
/SaralApp/src/config/config.js
to change apkVersionId , apkURL, BASE_URL as per the implementation. - 3.
./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.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