MENU
Android
To set up the environment to deploy apps for Android devices:STEP 1: Install the following:
Java Development Kit (JDK)
Gradle
Android Studio
STEP 2: Add Android SDK packages:
In Android Studio, follow Tools > SDK Manager and open Android SDK Manager. Install, for the targeted versions:
Android Platform SDK
Android SDK build-tools
Android Support Repository
STEP 3: Set environment variables:
set JAVA_HOME to the location of the JDK installation
set ANDROID_HOME to the location of the Android SDK installation
include the Android SDK directories 'tools/bin' and 'platform-tools' in the PATH variable.
On a Max or Linux, this involves modifying the file ~/.bash_profile, and reloading the terminal:
export ANDROID_HOME=/Development/android-sdk/ export PATH=${PATH}:/Development/android-sdk/ platform-tools:/Development/android-sdk/tools |
On Windows, in the search bar, search for 'Environment Variables' and select the 'Edit the system Environment Variables' option. On the dialog box, click 'Environment Variables'.
STEP 4: Generate a keystore:
keytool -genkey -v -keystore NAME-mobileapps.keystore -alias NAMEmobileapps -keyalg RSA -keysize 2048 -validity 10000keystore password? : xxxxxxxWhat is your first and last name? : xxxxxxWhat is the name of your organizational unit? : xxxxxxxxWhat is the name of your organization? : xxxxxxxxxWhat is the name of your City or Locality? : xxxxxxxWhat is the name of your State or Province? : xxxxxWhat is the two-letter country code for this unit? : xxx |
STEP 5: Enable 'Developer Mode' on the Android device:
Running the app on an Android device requires a USB cable connection from the device to your PC. To enable Developer Mode on the Android device, go to Settings and tap on the Build Number seven times. Then navigate to 'Developer options' and turn on 'USB debugging'.
STEP 6: Prepare batch files to ease the development process. On Windows:
sign.bat: This batch file automatically signs an app. 'apksigner.bat' and 'zipalign.exe' can be found in a location such as: C:\Program Files\Android\build-tools\28.0.3 |
del my-app.apkzipalign -v -p 4 platforms\android\app\build\outputs\apk\ release\app-release-unsigned.apk .\my-app.apkapksigner sign --ks my-app.keystore --ks-key-alias my-app --ks-pass pass:my-password my-app.apkcd \my_app |
compile.bat: This batch file compiles the Cordova project into an Android app and signs it with an incremented version number. To use it, first initialize the version number:
> set /A ver=10
> compile
install.bat: This directly installs the app onto a connected Android device. On Windows, 'adb.exe' can be found in: C:\Users\[user]\AppData\Local\Android\sdk\platform-tools |
adb shell su -c "mount -o rw,remount,rw /system"adb push my-app.apk /adb install my-app.apk |
r.bat: This runs and tests the app on a browser such as Chrome. |
cordova run browser --target=chrome --livereload --ssl |
STEP 7: Publish the app so that it can be downloaded worldwide:
Pick an Android app store:1) Google Play Storehttps://play.google.com/apps/publish
2) Huawei App Galleryhttps://developer.huawei.com/3) Samsung Galaxy Storehttps://developer.samsung.com/galaxy-store
Fill up the online registration forms, upload the .APK app file and keystore file(for app signing). For a smaller download size, you can generate a signed bundle in Android Studio by navigating to the Build menu.
To prepare for a privacy policy, considering purchasing service by iubenda.