Prerequisites:
Package | Version | Recommended Version |
---|---|---|
Node | 18+ | 18.16.1 |
NPM | 9+ | 9.5.1 |
Capacitor | 5+ | 5.5.1 |
Ionic | 7 | 7.2.0 |
Java(For Android) | 17+ | 17.0.5 |
Gradle(For Android) | 8+ | 8.5 |
Project Setup
1. Ionic-Android build Setup
- Install java
- Install Gradle
- Install Android Studio
- After Android studio installation, install SDK
- Open Android studio and goto settings/appearance and behavior/system settings/Android SDK
- Install appropriate Android sdk platform package.
- Add environment variables in ~/.bashrc
or ~/.bash_profile
as follows
export ANDROID_SDK_ROOT=path_to_sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
- Reference: https://ionicframework.com/docs/installation/android
CLI Setup
- `npm install -g ionic`
- `npm install -g capacitor`
2. Project Setup
- git clone the repo(https://github.com/Sunbird-AIAssistant/djp-mobile-app.git).
- Rename config.properties.example
file to config.properties
and put all the valid credentials and api endpoint.
- Run `./build.sh`
- npm i
- npx cap add android
<!-- for windows -->
install git-bash https://git-scm.com/download/win and run `./build.sh`
3. How to build apk
- To check attached devices do
adb devices
npm run ionic-build
(Make sure you have attached device)- Apk location
project_folder/android/app/build/outputs/apk/apk_debug.apk
3. How to update or add new appicon
- Add the new icon.png file in assets folder in project root
- icon resolution should be 1024x1024
- Run npx @capacitor/assets generate --iconBackgroundColor '#eeeeee' --iconBackgroundColorDark '#222222'
github reference - https://github.com/ionic-team/capacitor-assets
5. How to debug apk
- Open chrome and enter
chrome://inspect
- Select app