You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

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:

Fixes for the "values-ldltr-v21.xml file not found" Error
  • Clean and Rebuild the Project
    This is the first go-to for most build resource issues. In Android Studio, head to Build > Clean Project first, then once that finishes, run Build > Rebuild Project. Sometimes cached intermediate files (like the ones in your intermediates/mergeDebugResources/ path) get corrupted, and wiping them out can resolve the missing file error.

  • Check for Missing Resource Files
    Navigate to your project's res directory and look for the values-ldltr-v21 folder. If it's missing entirely, it might have been omitted from the Codecanyon package. You can create it manually:

    1. Right-click the res folder > New > Android Resource Directory
    2. Set Directory name to values-ldltr-v21
    3. Make sure Available qualifiers includes "Layout Direction" (set to Left to Right) and "Version" (API level 21)
    4. Inside this folder, create a blank values.xml file (you can copy contents from the regular values-v21/values.xml if needed)
  • Invalidate Caches and Restart Android Studio
    Corrupted IDE caches can also cause weird resource merge issues. Go to File > 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-level build.gradle file and make sure the sourceSets block (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-v21 is being included.

  • Resolve the ExecutionException Root Cause
    The java.util.concurrent.ExecutionException is usually a side effect of the missing file error. Fixing the missing values-ldltr-v21.xml should 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

火山引擎 最新活动