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.
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 androidto check if you have all required SDK versions, build tools, and environment variables set correctly. Make sureANDROID_HOMEorANDROID_SDK_ROOTis configured, and theplatform-tools/toolsfolders are in your systemPATH.
- Run
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
- Old cached files frequently cause conflicts. Try cleaning everything up and rebuilding from scratch:
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.gradleand verify:compileSdkVersion,minSdkVersion, andtargetSdkVersionmatch your Cordova version and plugin requirements.- There are no duplicate dependencies or version conflicts listed.
- Cordova uses Gradle for Android builds. Open
Check for font-related residual references
- Even if you deleted font files, leftover references might linger. Double-check:
- Your
config.xmlfor<resource-file>tags pointing to non-existent fonts. - CSS files for
@font-facedeclarations referencing removed fonts.
- Your
- Even if you deleted font files, leftover references might linger. Double-check:
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

