Cordova AndroidX Build Plugin

1.0.4 · active · verified Tue Apr 21

The `cordova-androidx-build` plugin (current stable version 1.0.4) automatically migrates Cordova project code between Android Support Libraries and AndroidX libraries during the build process. This plugin is crucial for maintaining compatibility across different `cordova-android` versions, especially those transitioning to or already using AndroidX (e.g., `cordova-android@9` and newer). A key differentiator is its use of Gradle scripts, enabling it to work reliably on both local development machines and cloud build services like PhoneGap Build, which is not possible with hook-script-based alternatives such as `cordova-plugin-androidx-adapter`. It provides bidirectional migration capabilities, ensuring plugins build correctly whether the target project uses older Support Libraries or the newer AndroidX ecosystem. Release cadence is typically on an as-needed basis to address compatibility issues or updates in the Android build ecosystem.

Common errors

Warnings

Install

Quickstart

Demonstrates how to install the plugin directly or declare it as a dependency for another Cordova plugin, and then build the Android project.

cordova plugin add cordova-androidx-build

# Or, integrate as a dependency in your plugin.xml for other plugins:
# (This allows your plugin to ensure the project is correctly configured for AndroidX)
# <?xml version='1.0' encoding='utf-8'?>
# <plugin id="my-awesome-plugin" version="1.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
#   <name>My Awesome Plugin</name>
#   <platform name="android">
#     <dependency id="cordova-androidx-build" />
#     <!-- Your plugin's Android specific source files and configurations -->
#   </platform>
# </plugin>

# After adding, simply build your Cordova project as usual:
cordova build android

view raw JSON →