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

Cordova Android项目构建失败求助(iOS构建正常)

Hey there! Sorry to hear you're stuck with Android builds while iOS works perfectly—let's break this down step by step to get you sorted out.

Troubleshooting Cordova/PhoneGap Android Build Failures (iOS Builds Work)

First off, since removing fonts didn't fix the issue, let's start with the most critical step: grab the full verbose error log instead of relying solely on screenshots. Run your build command with verbose mode enabled to capture every detail of where the process fails:

cordova build android --verbose

This will output the exact line or error message that's breaking the build, which is way more useful for pinpointing the root cause than a screenshot.

That said, here are common fixes for Android build issues that often pop up even when iOS builds run smoothly:

  • Validate your Android environment setup

    • Run cordova requirements android to check if you have all required SDK versions, build tools, and environment variables set correctly. Make sure ANDROID_HOME or ANDROID_SDK_ROOT is configured, and the platform-tools/tools folders are in your system PATH.
  • Wipe build caches and artifacts

    • Old cached files frequently cause conflicts. Try cleaning everything up and rebuilding from scratch:
      cordova clean android
      rm -rf platforms/android/.gradle
      rm -rf ~/.gradle/caches
      cordova build android
      
  • Check plugin compatibility

    • iOS and Android handle plugins differently—an iOS-friendly plugin might have unaddressed Android bugs or missing configuration. Try removing non-essential plugins one by one, rebuilding after each removal, to see if the issue goes away. If you added a plugin recently, check its GitHub issues page for reported Android build problems.
  • Inspect Gradle configurations

    • Cordova uses Gradle for Android builds. Open platforms/android/build.gradle and verify:
      • compileSdkVersion, minSdkVersion, and targetSdkVersion match your Cordova version and plugin requirements.
      • There are no duplicate dependencies or version conflicts listed.
  • Check for font-related residual references

    • Even if you deleted font files, leftover references might linger. Double-check:
      • Your config.xml for <resource-file> tags pointing to non-existent fonts.
      • CSS files for @font-face declarations referencing removed fonts.

Once you have the verbose error log, look for keywords like "failed to resolve dependency", "duplicate class", or "resource not found"—these usually point directly to the problem. If you can share the specific error lines from the log, we can narrow things down even further!

内容的提问来源于stack exchange,提问作者rahul.sapkal23

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 12:14:47