Android构建报错:Values-ldltr-v21.xml缺失及AAPT2执行异常
Hey there! Let's tackle this resource merge error you're hitting with your Codecanyon app code. I’ve seen this pop up a few times with third-party projects, so here are some straightforward fixes to try:
Clean and Rebuild the Project
This is the first go-to for most build resource issues. In Android Studio, head toBuild > Clean Projectfirst, then once that finishes, runBuild > Rebuild Project. Sometimes cached intermediate files (like the ones in yourintermediates/mergeDebugResources/path) get corrupted, and wiping them out can resolve the missing file error.Check for Missing Resource Files
Navigate to your project'sresdirectory and look for thevalues-ldltr-v21folder. If it's missing entirely, it might have been omitted from the Codecanyon package. You can create it manually:- Right-click the
resfolder > New > Android Resource Directory - Set Directory name to
values-ldltr-v21 - Make sure Available qualifiers includes "Layout Direction" (set to Left to Right) and "Version" (API level 21)
- Inside this folder, create a blank
values.xmlfile (you can copy contents from the regularvalues-v21/values.xmlif needed)
- Right-click the
Invalidate Caches and Restart Android Studio
Corrupted IDE caches can also cause weird resource merge issues. Go toFile > Invalidate Caches...and select "Invalidate and Restart". This will clear Studio's cached data and reload your project from scratch.Check Gradle Configuration
Sometimes third-party projects have misconfigured Gradle scripts that don't properly include certain resource directories. Open your app-levelbuild.gradlefile and make sure thesourceSetsblock (if present) includes all resource directories. It should look something like this:android { sourceSets { main { res.srcDirs = ['src/main/res'] } } }If there are any custom paths here, ensure
values-ldltr-v21is being included.Resolve the ExecutionException Root Cause
Thejava.util.concurrent.ExecutionExceptionis usually a side effect of the missing file error. Fixing the missingvalues-ldltr-v21.xmlshould resolve this, but if not, check the full error log (expand the error in the Build tab) to see what the underlying exception is—often it's a related resource issue like a missing drawable or malformed XML.
内容的提问来源于stack exchange,提问作者Stephen Kent




