android { ... buildToolsVersion "29.0.2" // Replace with your version ... aaptOptions.usePrecompiled = true ... }
android { ... buildToolsVersion "29.0.2" // Replace with your version ... aaptOptions { executable "path/to/aapt2" } ... }
其中"path/to/aapt2"是aapt2可执行文件的完整路径,例如,Windows上默认的aapt2路径是"C:\Users{username}\AppData\Local\Android\Sdk\build-tools{version}\aapt2.exe"。