{"record":{"id":"470c3c5dd06cfca3","repo":"apache/cordova-android","slug":"could-not-find-any-apks-to-deploy","errorCode":null,"errorMessage":"Could not find any APKs to deploy","messagePattern":"Could not find any APKs to deploy","errorType":"exception","errorClass":"CordovaError","httpStatus":null,"severity":"error","filePath":"lib/run.js","lineNumber":70,"sourceCode":" *   use a started emulator. If no started emulators are found it will attempt\n *   to start an avd. If no avds are found it will error out.\n *\n * @param   {Object}  runOptions  various run/build options. See Api.js build/run\n *   methods for reference.\n *\n * @return  {Promise}\n */\nmodule.exports.run = async function (runOptions = {}) {\n    const { packageType, buildType } = build.parseBuildOptions(runOptions, null, this.root);\n\n    // Android app bundles cannot be deployed directly to the device\n    if (packageType === PackageType.BUNDLE) {\n        throw new CordovaError('Package type \"bundle\" is not supported during cordova run.');\n    }\n\n    const buildResults = this._builder.fetchBuildResults(buildType);\n    if (buildResults.apkPaths.length === 0) {\n        throw new CordovaError('Could not find any APKs to deploy');\n    }\n\n    const targetSpec = buildTargetSpec(runOptions);\n    const resolvedTarget = await target.resolve(targetSpec, buildResults);\n    events.emit('log', `Deploying to ${formatResolvedTarget(resolvedTarget)}`);\n\n    if (resolvedTarget.type === 'emulator') {\n        await emulator.wait_for_boot(resolvedTarget.id);\n    }\n\n    const manifest = new AndroidManifest(this.locations.manifest);\n    const cordovaGradleConfigParser = CordovaGradleConfigParserFactory.create(this.locations.root);\n\n    return target.install(resolvedTarget, { manifest, buildResults, cordovaGradleConfigParser });\n};\n\nmodule.exports.listDevices = async function () {\n    events.emit('log', `\\nAvailable ${this.platform} devices:`);","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/cordova-android/blob/7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3/lib/run.js#L52-L88","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","solutions":["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","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","Ensure the buildType you run matches what you built, and that packageType is apk not bundle"],"exampleFix":"# before\ncordova build android --packageType=bundle\ncordova run android        # throws: no APKs\n\n# after\ncordova build android\ncordova run android        # builds (if needed) and deploys the apk","handlingStrategy":"validation","validationCode":"// verify an APK for the requested buildType exists before run\nconst fs = require('fs');\nconst outDir = `platforms/android/app/build/outputs/apk/${buildType}`;\nif (!fs.existsSync(outDir) || fs.readdirSync(outDir).filter(f => f.endsWith('.apk')).length === 0) {\n  throw new Error('No APK built yet — run `cordova build android` first');\n}","typeGuard":null,"tryCatchPattern":"try { await cordova.run('android'); } catch (e) {\n  if (/Could not find any APKs to deploy/.test(e.message)) { /* run cordova build android (matching buildType), then retry */ }\n}","preventionTips":["Use `cordova run android` end-to-end instead of deploy-only flows","Match run's --debug/--release to the build you produced","Don't delete platforms/android/app/build/outputs between build and run"],"tags":["cordova","cordova-android","run","build","apk"],"backgroundTag":"missing-build-artifact","analyzedSha":"7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3","analyzedAt":"2026-08-22T04:57:58.868Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}