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

如何在Cordova(Android平台7)中设置android.enableAapt2=false?

How to set android.enableAapt2=false in Cordova Android 7

Hey there! I’ve worked with Cordova Android 7 quite a bit, so I can walk you through exactly how to get this flag set up properly—here are two reliable methods, pick the one that fits your workflow best:

  • Navigate to the root directory of your Cordova project.
  • Look for a file named gradle.properties—if it doesn’t exist, create a brand new one.
  • Open the file and add this line at the end:
    android.enableAapt2=false
    
  • Save the file, then run cordova prepare android to apply the changes. This method is ideal because it won’t get overwritten when you remove or re-add the Android platform later.

Method 2: Modify platform-specific Gradle config (for one-off changes)

If you need to target only the Android platform directly (note: this change might get reset if you update or re-add the platform):

  • Go to the platforms/android folder in your project.
  • Open the gradle.properties file located here.
  • Add the same line as above:
    android.enableAapt2=false
    
  • Save the file and rebuild your project with cordova build android.

A quick side note: AAPT2 is disabled by default in some older Cordova Android versions, but explicitly setting this flag in v7 will ensure your build uses the older AAPT tool exactly as you need it to.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 11:56:32