mkdir www
cp -rp artifact www/
npm install -g cordova
cordova platform add android
brew install --cask temurin@17
npm run build:release downloads and uses Gradle 8.14.2 automatically.
brew install --cask android-studio
-
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 36
-
Android SDK Build-Tools 36.0.0
-
Android SDK Command-line Tools (latest)
-
Android SDK Platform-Tools
-
- Set the JAVA_HOME environment variable to the location of your JDK installation
- Set the ANDROID_HOME environment variable to the location of your Android SDK installation
- It is also recommended that you add the Android SDK's command-line tools, emulator and platform-tools directories to your PATH
export JAVA_HOME=<java-location>
export ANDROID_HOME=<sdk-location>
export PATH=$PATH:$ANDROID_HOME/platform-tools/
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin/
export PATH=$PATH:$ANDROID_HOME/emulator/export ANDROID_HOME=/c/Users/icer/AppData/Local/Android/SdkIn 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 17.0.20
Android SDK: installed true
Android target: installed android-36
Gradle: installed <gradle-8.14.2-location>/bin/gradle
cordova build android
-
Create a Device
Android Studio - Virtual Device Manager - Create Device
-
Run App
cordova run android --emulator
- Modify version in
config.xml; the build writes it to the Android package automatically. - Replace files in
www\with latest package download from Azure Devops Pipelines. - Copy
.env.exampleto.env, set the signing credentials, and build release withnpm run build:release. - Upload aab package to Google Play Console
- Production -> Create Release -> Upload
- Download
Signed, universal APKfrom app bundle. - Remember to upload latest APK to github release.
config.xml
<preference name="android-targetSdkVersion" value="36" />cordova platform remove android
cordova platform add android@15.0.0
sdkmanager.bat "platforms;android-36"
sdkmanager.bat "build-tools;36.0.0"
cordova requirements
npm run build:releaseQ: 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.