apache/cordova-android · error · CordovaError

Could not find any APKs to deploy

Error message

Could not find any APKs to deploy

What it means

run.js fetches the builder's stored build results for the requested buildType and throws when apkPaths is empty — cordova run found no built APK matching the build type (debug/release) it is trying to deploy. The deploy step literally has nothing to adb install.

Source

Thrown at lib/run.js:70

 *   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);

    return target.install(resolvedTarget, { manifest, buildResults, cordovaGradleConfigParser });
};

module.exports.listDevices = async function () {
    events.emit('log', `\nAvailable ${this.platform} devices:`);

View on GitHub (pinned to 7c1e190064)

Solutions

  1. Run the full pipeline that builds first: `cordova run android` builds then deploys; if you used a deploy-only flow, run `cordova build android` (matching --debug/--release) first
  2. Check that the expected APK exists under platforms/android/app/build/outputs/apk/<debug|release>/ and that gradle did not fail; re-run build and read the gradle error output
  3. Ensure the buildType you run matches what you built, and that packageType is apk not bundle

Example fix

# before
cordova build android --packageType=bundle
cordova run android        # throws: no APKs

# after
cordova build android
cordova run android        # builds (if needed) and deploys the apk
Defensive patterns

Strategy: validation

Validate before calling

// verify an APK for the requested buildType exists before run
const fs = require('fs');
const outDir = `platforms/android/app/build/outputs/apk/${buildType}`;
if (!fs.existsSync(outDir) || fs.readdirSync(outDir).filter(f => f.endsWith('.apk')).length === 0) {
  throw new Error('No APK built yet — run `cordova build android` first');
}

Try / catch

try { await cordova.run('android'); } catch (e) {
  if (/Could not find any APKs to deploy/.test(e.message)) { /* run cordova build android (matching buildType), then retry */ }
}

Prevention

When it happens

Trigger: `cordova run android` (or --debug/--release) when the corresponding APK was never built, e.g. run invoked in a way that skips the build step, a previous build failed after clean, outputs were deleted (gradle clean, platforms/ regenerated), or only a bundle was built (see the bundle guard above).

Common situations: Fresh clone where the developer runs a deploy-only command before building; build failure swallowed by CI scripts; mismatch between the buildType requested for run and the one previously built (built debug, running --release); antivirus/gradle daemon deleting outputs.

Related errors


AI-assisted analysis of apache/cordova-android@7c1e190064 (2026-08-22). Data as JSON: /api/errors/470c3c5dd06cfca3. Report an issue: GitHub.