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

Cordova Android构建失败:尝试引用暂未可用的API 28

Fixing Cordova Android Build Failure Due to Unavailable API 28 Dependency

Hey there! Sorry to hear your Cordova Android build started failing unexpectedly because of that API 28 dependency issue—this is a common gotcha when using version wildcards in your Gradle configs, so let’s get this sorted out quickly.

What’s causing the problem?

The root issue here is using the + wildcard in your support library dependency (like com.android.support:design:+). This tells Gradle to automatically pull the latest available version of the library, but if the latest version tied to API 28 is temporarily unavailable or broken, your build will fail.

Step-by-step fix

  1. Locate the build.gradle file in your Cordova project—this is usually found at platforms/android/app/build.gradle (or check other relevant Gradle config files if you’ve customized your setup).
  2. Find the dependencies block where the problematic line is:
    dependencies {
        implementation 'com.android.support:design:+'
        // Other dependencies...
    }
    
  3. Replace the + with a specific, stable version of the support library. For API 28, the reliable stable version is 28.0.0:
    dependencies {
        implementation 'com.android.support:design:28.0.0'
        // Other dependencies...
    }
    
  4. Pro tip: While you’re at it, check for other support library dependencies in the same block that use + (like com.android.support:appcompat-v7:+ or com.android.support:recyclerview-v7:+) and replace those wildcards with the same 28.0.0 version. This prevents similar build failures from popping up in the future.
  5. Save the file, then clean your build cache and re-run the build:
    cordova clean android
    cordova build android
    

If you still run into issues

If the build still fails after this, double-check that your Cordova Android platform version is compatible with API 28. If you’re using a newer Cordova Android version (like 9.0.0+), it might have migrated to AndroidX instead of the old support libraries. In that case, you’ll need to switch to the AndroidX equivalent dependency:

implementation 'com.google.android.material:material:1.0.0'

Hope this gets your build back up and running smoothly!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 08:05:42