apache/cordova-android · error · CordovaError
Package type "bundle" is not supported during cordova run.
Error message
Package type "bundle" is not supported during cordova run.
What it means
cordova run android refuses to deploy when the build options resolve to packageType 'bundle'. Android App Bundles (.aab) are a Play Store upload format that a device cannot install; only APKs can be pushed via adb, so run aborts before looking for build outputs.
Source
Thrown at lib/run.js:65
return `${type} ${id}`;
}
/**
* Runs the application on a device if available. If no device is found, it will
* use a started emulator. If no started emulators are found it will attempt
* to start an avd. If no avds are found it will error out.
*
* @param {Object} runOptions various run/build options. See Api.js build/run
* methods for reference.
*
* @return {Promise}
*/
module.exports.run = async function (runOptions = {}) {
const { packageType, buildType } = build.parseBuildOptions(runOptions, null, this.root);
// Android app bundles cannot be deployed directly to the device
if (packageType === PackageType.BUNDLE) {
throw new CordovaError('Package type "bundle" is not supported during cordova run.');
}
const buildResults = this._builder.fetchBuildResults(buildType);
if (buildResults.apkPaths.length === 0) {
throw new CordovaError('Could not find any APKs to deploy');
}
const targetSpec = buildTargetSpec(runOptions);
const resolvedTarget = await target.resolve(targetSpec, buildResults);
events.emit('log', `Deploying to ${formatResolvedTarget(resolvedTarget)}`);
if (resolvedTarget.type === 'emulator') {
await emulator.wait_for_boot(resolvedTarget.id);
}
const manifest = new AndroidManifest(this.locations.manifest);
const cordovaGradleConfigParser = CordovaGradleConfigParserFactory.create(this.locations.root);
View on GitHub (pinned to 7c1e190064)
Solutions
- Drop --packageType=bundle for deployment: `cordova run android` (defaults to apk)
- If using a buildConfig, point run at a config without packageType=bundle: `cordova run android --buildConfig=build.dev.json`
- Keep bundle for release artifacts only: `cordova build android --release -- --packageType=bundle` produces the .aab for Play Store upload
Example fix
# before cordova run android --release -- --packageType=bundle # after cordova build android --release -- --packageType=bundle # produce .aab for Play cordova run android --release # deploy apk to device
Defensive patterns
Strategy: validation
Validate before calling
// guard deploy scripts against bundle configuration
const opts = parseArgs();
if (opts.packageType === 'bundle' && argv._.includes('run')) {
throw new Error('packageType=bundle cannot be deployed; use default apk for run');
} Try / catch
try { await cordova.run('android', runOptions); } catch (e) {
if (/Package type "bundle" is not supported during cordova run/.test(e.message)) { /* strip packageType and rebuild+run as apk */ }
} Prevention
- Keep release-bundle commands separate from run/deploy commands in scripts
- Default to apk in shared build.json; override to bundle only for Play Store artifact builds
When it happens
Trigger: Running `cordova run android -- --packageType=bundle`, or having packageType=bundle stored in build.json (the --buildConfig file) / set as a persistent preference, so build.parseBuildOptions yields BUNDLE during run.
Common situations: Copy-pasting release build commands (which legitimately use --packageType=bundle for Play uploads) into a run/deploy workflow; a build.json used for both CI artifact generation and local device testing.
Related errors
- Could not find any APKs to deploy
- Could not find target matching ${inspect(spec)}
- Required attribute "src" not specified in <framework> elemen
- Required attribute "src" not specified in <asset> element fr
- Required attribute "target" not specified in <asset> element
AI-assisted analysis of apache/cordova-android@7c1e190064 (2026-08-22).
Data as JSON: /api/errors/e6cbc93adbd5e3a1.
Report an issue: GitHub.