Cordova Android Clean Build

User
android cordova clean build
Assistant
To perform a **clean build** in an **Apache Cordova** Android project, follow these steps:

### ๐Ÿ”„ **1. Clean the Cordova Android Platform**

cordova clean android

> This command removes the `platforms/android/build` directory and resets the build state.

If `cordova clean` isn't available in your version (older ones), you can manually do it:

rm -rf platforms/android/build
rm -rf platforms/android/app/build

### ๐Ÿงน **2. Optional: Remove `platforms` and `plugins` for a full clean**

This is more aggressive, useful for corrupted builds:

rm -rf platforms
rm -rf plugins
rm -rf node_modules
rm package-lock.json
npm install
cordova platform add android
cordova plugin add <plugins-you-need>

### โš™๏ธ **3. Build Again**

cordova build android

### โœ… **Optional: Run in Device/Emulator**

cordova run android

### ๐Ÿšจ Tips if You Face Issues

– Ensure `ANDROID_HOME` is properly set in your environment.
– If you're using Gradle directly, you can also try:

cd platforms/android
./gradlew clean

Let me know if you're using Android Studio or CLI only โ€” I can tailor the steps for that.

Leave a Comment

Your email address will not be published. Required fields are marked *