mkdir www
cp -rp artifact www/
npm install -g cordova
cordova platform add android
brew tap adoptopenjdk/openjdk
brew install --cask adoptopenjdk8
brew install gradle
-
Install Android Studio
-
Adding SDK Packages
Open the Android SDK Manager (Tools > SDK Manager in Android Studio, or sdkmanager on the command line), and make sure the following are installed:
-
Android Platform SDK for your targeted version of Android
-
Android SDK build-tools version 29.0.2 or higher
Open the Android Studio SDK Manager
-
In the Android SDK Tools tab, uncheck Hide Obsolete Packages
-
Check Android SDK Tools (Obsolete)
-
- Set the JAVA_HOME environment variable to the location of your JDK installation
- Set the ANDROID_SDK_ROOT environment variable to the location of your Android SDK installation
- It is also recommended that you add the Android SDK's tools, emulator and platform-tools directories to your PATH
export JAVA_HOME=<java-location>
export ANDROID_SDK_ROOT=<sdk-location>
export ANDROID_HOME=<sdk-location>
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator/
export ANDROID_SDK_ROOT=/c/Users/icer/AppData/Local/Android/Sdk
export ANDROID_HOME=/c/Users/icer/AppData/Local/Android/Sdk
In the cordova project directory, run
cordova requirements
If you have successfully installed all the required tools above, the result should be like:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-32,android-30,android-29
Gradle: installed /usr/local/Cellar/gradle/7.4/bin/gradle
cordova build
-
Create a Device
Android Studio - Virturl Device Manager - Create Device
-
Run App
cordova run android --emulator
- Modify version in
config.xml
. - Replace files in
www\
with latest package download from Azure Devops Pipelines. - Build release with
yarn build:release
. - Upload aab package to Google Play Console
- Production -> Create Release -> Upload
- Download
Signed, universal APK
from app bundle. - Remember to upload latest APK to github release.
config.xml
<preference name="android-targetSdkVersion" value="35" />
cordova platform remove android
cordova platform add android
sdkmanager.bat "platforms;android-35"
sdkmanager.bat "build-tools;35.0.0"
cordova requirements
yarn build:release
Q: How do I fix the “Unsupported class file major version 66” error when compiling Android with Cordova?
A: This is caused by using a Java version that's too high; downgrading to Java 17 will resolve the issue.