title: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
body: <p>I have a old android project, Now I decided to run it, After migration to androidX and add some upgrade in libraries I got these errors when I am trying to run it:</p>
  <pre><code>* Exception is:
  org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':mergeDebugResources'.
      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
      at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
      at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
      at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
      at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
      at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
      at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
      at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
      at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
      at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
      at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
      at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
      at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
      at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
      at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
      at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
      at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
      at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
  Caused by: org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  Output:  /mnt/Media/usb/mobile-android/client14/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:5159: error: &lt;item&gt; inner element must either be a resource reference or empty.
  /mnt/Media/usb/mobile-android/client14/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:5163: error: &lt;item&gt; inner element must either be a resource reference or empty.
  /mnt/Media/usb/mobile-android/client14/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:5182: error: &lt;item&gt; inner element must either be a resource reference or empty.
  /mnt/Media/usb/mobile-android/client14/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:5228: error: &lt;item&gt; inner element must either be a resource reference or empty.
  /mnt/Media/usb/mobile-android/client14/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:5229: error: &lt;item&gt; inner element must either be a resource reference or empty.
  
  Command: /home/alt/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-4818971-linux.jar/8ae53ed779dc0eb0d7edfbb9c8e24cf8/aapt2-3.2.0-4818971-linux/aapt2 compile --legacy \
          -o \
          /mnt/Media/usb/mobile-android/client14/build/intermediates/res/merged/debug \
          /mnt/Media/usb/mobile-android/client14/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
  </code></pre>
  <p>This is my gradle:</p>
  <pre><code>buildscript {
      repositories {
          google()
          mavenCentral()
          mavenLocal()
      }
  
      dependencies {
          classpath 'com.android.tools.build:gradle:3.2.0'
  //        classpath 'com.guardsquare.dexguard.gradle:dexguard-gradle-plugin:8.0.17'
      }
  }
  
  apply plugin: 'com.android.application'
  
  allprojects{
      repositories{
          google()
          mavenCentral()
          mavenLocal()
  
          maven {
              url &quot;https://repo1.maven.org/maven2&quot;
          }
          maven {
              url &quot;https://repo.spring.io/libs-milestone&quot;
          }
      }
  }
  
  android {
      compileSdkVersion 29
      buildToolsVersion &quot;27.0.3&quot;
  
      signingConfigs {
          debug {
              storeFile     file('pmb-android.keystore')
              storePassword 'caspianmbkeystore'
              keyAlias      'caspian_mb'
              keyPassword   'caspianmbkeystore'
          }
          release {
              storeFile     file('pmb-android.keystore')
              storePassword 'caspianmbkeystore'
              keyAlias      'caspian_mb'
              keyPassword   'caspianmbkeystore'
          }
      }
  
      defaultConfig {
          applicationId &quot;com.cas.android&quot;
          targetSdkVersion 29
          minSdkVersion 19
          versionCode 1391
          versionName &quot;1.3.9.1&quot;
          vectorDrawables.useSupportLibrary = true
          signingConfig signingConfigs.debug
          multiDexEnabled true
      }
  
      buildTypes {
          release {
              minifyEnabled false
              shrinkResources false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
          debug {
              minifyEnabled false
              shrinkResources false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  
      compileOptions {
          sourceCompatibility org.gradle.api.JavaVersion.VERSION_1_8
          targetCompatibility org.gradle.api.JavaVersion.VERSION_1_8
      }
  
      packagingOptions {
          exclude 'scala.*'
          exclude 'META-INF/DEPENDENCIES.txt'
          exclude 'META-INF/LICENSE.txt'
          exclude 'META-INF/NOTICE.txt'
          exclude 'META-INF/NOTICE'
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/DEPENDENCIES'
          exclude 'META-INF/notice.txt'
          exclude 'META-INF/license.txt'
          exclude 'META-INF/dependencies.txt'
          exclude 'META-INF/LGPL2.1'
          exclude 'META-INF/LGPL2.1'
          exclude 'META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties'
      }
  
      lintOptions{
          checkReleaseBuilds false
          abortOnError false
      }
  }
  
  dependencies {
      implementation 'androidx.multidex:multidex:2.0.1'
      implementation 'com.basgeekball:awesome-validation:2.0'
      implementation 'com.specyci:residemenu:1.6'
      implementation 'org.greenrobot:eventbus:3.0.0'
      implementation 'com.google.guava:guava:24.1-jre'
      implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.6'
      implementation 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
      implementation 'com.google.android.material:material:1.4.0'
      implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
      implementation 'androidx.mediarouter:mediarouter:1.2.5'
      implementation 'androidx.legacy:legacy-support-v13:1.0.0'
      implementation 'androidx.recyclerview:recyclerview:1.2.1'
      implementation 'androidx.cardview:cardview:1.0.0'
      implementation 'androidx.appcompat:appcompat:1.3.1'
      implementation 'com.google.android.gms:play-services:12.0.1'
      implementation group: 'joda-time', name: 'joda-time', version: '2.9.9'
      implementation group: 'com.ibm.icu', name: 'icu4j', version: '51.1'
  }
  </code></pre>
  <p>This is gradle.properies:</p>
  <pre><code>android.enableJetifier=true
  android.injected.build.model.only.versioned=3
  android.useAndroidX=true
  </code></pre>
  <p>What is the problem?</p>