You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行cordova build android --release输出异常且未生成APK

Troubleshooting Missing APK After Cordova Android Release Build

Hey Steve, I’ve run into this exact head-scratcher before—let’s break down why your APK isn’t showing up and how to fix it:

  • That initial output is just setup info, not an error
    The message Android Studio project detected ANDROID_HOME=/Users//Library/Android/sdk JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home is just Cordova confirming it’s recognized your Android environment and project structure. The actual build process might be failing silently, or the full output got truncated in your terminal.

  • Watch for hidden build errors
    Re-run the build command cordova build android --release and keep a close eye for red error messages. Common culprits include:

    • Missing Android SDK platforms (you might need to install the specific SDK version your project targets)
    • Syntax errors or corrupted files in your www folder
    • Permission issues accessing the Android SDK directory
  • Fix your malformed ANDROID_HOME path
    Notice the double slash // in your ANDROID_HOME path? It should be /Users/[your-mac-username]/Library/Android/sdk. This broken path could be stopping Cordova from accessing critical SDK tools. Update your environment variables to point to the correct SDK location.

  • Clean cached files before rebuilding
    Stale build artifacts often cause weird, silent failures. Run this first to wipe old data:

    cordova clean android
    

    Then re-run the release build command—this forces a fresh start.

  • Manually check the output directory
    Even if the terminal doesn’t mention it, the APK might already exist! Navigate to this folder in Finder:

    [your-project-root]/platforms/android/app/build/outputs/apk/release/
    

    Look for app-release-unsigned.apk (you’ll need to sign this file before distributing it).

  • Verify your Java and SDK versions
    Your JDK 1.8 might be outdated for newer Cordova versions. Check your Cordova version with cordova -v and confirm it supports JDK 1.8—many recent releases require JDK 11. Also, make sure you have the latest Android SDK Build Tools installed via Android Studio.

内容的提问来源于stack exchange,提问作者Steve

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 08:04:07