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

使用Construct 2导出Cordova项目构建Android遇android:ttcIndex错误求助

Fixing the "android:ttcIndex" Error in Cordova Android Builds (Construct 2 -> Intel XDK Workflow)

Hey there, let's tackle that frustrating build error you're hitting. The android:ttcIndex attribute was introduced in Android 8.0 (API Level 26), so this error pops up when your Cordova project's build configuration targets an older API level, but some resource (from Construct 2's export or Intel XDK's setup) uses this newer attribute. Here's how to fix it step by step:

1. Update Your Cordova Android Platform Version

Older Cordova Android platforms don't support API 26+ out of the box, so let's upgrade to a version that does:

  • First, remove the existing Android platform:
    cordova platform remove android
    
  • Install a stable Cordova Android version that supports API 26+ (v7.0.0 or newer; v11.x is a solid recent choice):
    cordova platform add android@11.0.0
    

2. Align Your Build Configuration

Make sure your project compiles against an API level that includes the ttcIndex attribute. Using config.xml ensures changes persist across builds:
Open your project's config.xml, find the <platform name="android"> section, and add these preferences:

<preference name="android-compileSdkVersion" value="33" />
<preference name="android-targetSdkVersion" value="33" />
<preference name="android-buildToolsVersion" value="33.0.2" />

(Note: You can adjust the version numbers to the latest stable API level available, but ensure compileSdkVersion and targetSdkVersion are at least 26.)

If you prefer editing the build.gradle directly (just note this might get overwritten if you re-add the platform), open platforms/android/build.gradle and update the android block:

android {
    compileSdkVersion 33
    buildToolsVersion "33.0.2"

    defaultConfig {
        minSdkVersion 21 // Adjust based on your app's minimum supported Android version
        targetSdkVersion 33
    }
}

3. Clean Build Cache and Recompile

Old build artifacts can cause conflicts, so clear them before rebuilding:

cordova clean android
cordova build android

4. Double-Check Construct 2 Export Settings

When exporting from Construct 2 to Intel XDK, ensure you're targeting a modern Android API level (26 or higher) in the export settings. This prevents Construct 2 from generating resources that rely on newer attributes without your project supporting them.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 11:07:51