title: Android / Execution failed for task checkDebugAarMetadata / A failure occurred while executing CheckAarMetadataWorkAction
body: <p><em>TL'DR:</em> In <a href="https://github.com/Umweltzone/roadsigns" rel="noreferrer">this Android Kotlin library</a> I <a href="https://github.com/Umweltzone/roadsigns/commit/d5d8d24fab772e486b222e6c747df203a02986b5" rel="noreferrer">updated from Gradle 5.6.4 to 6.6.1</a> (commit <code>d5d8d2</code>). Now I cannot build a project depending on the aar anymore.</p>
  <h1>Test setup</h1>
  <p>I build and deploy the <em>aar</em> to <em>mavenLocal</em> ...</p>
  <pre><code>$ ./gradlew clean :roadsigns:assemble
  $ ./gradlew publishToMavenLocal
  </code></pre>
  <p>... and then reference the deployed library artifact in the sample Android <code>app</code> module. First I add <code>mavenLocal()</code> in the root <em>build.gradle</em> file:</p>
  <pre><code>allprojects {
      repositories {
          google()
          mavenCentral()
          jcenter()
          mavenLocal() // &lt;-- Add this
      }
  }
  </code></pre>
  <p>I reference the <code>mavenLocal()</code> dependency directly:</p>
  <pre><code>dependencies {
      implementation
      // implementation project(&quot;:roadsigns&quot;)
      implementation &quot;info.metadude.kotlin.library.roadsigns:roadsigns:$version&quot;
      implementation Libs.kotlinStdlib
      // ...
  </code></pre>
  <h1>The error</h1>
  <p>When I build the sample app then I get the following <strong>build error</strong>:</p>
  <pre><code>$ ./gradlew clean assembleDebug
  
  Execution failed for task ':checkDebugAarMetadata'.
  &gt; Multiple task action failures occurred:
  
     &gt; A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
        &gt; A dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) does
          not specify an aarFormatVersion value, which is a required value.
          Dependency: info.metadude.kotlin.library.roadsigns:roadsigns:4.0.0.
          AAR metadata file: /home/USERNAME/.m2/repository/info/metadude/kotlin/library/roadsigns/roadsigns/4.0.0/roadsigns-4.0.0-javadoc.jar.
  
     &gt; A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
        &gt; A dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) does
          not specify an aarFormatVersion value, which is a required value.
          Dependency: info.metadude.kotlin.library.roadsigns:roadsigns:4.0.0.
          AAR metadata file: /home/USERNAME/.m2/repository/info/metadude/kotlin/library/roadsigns/roadsigns/4.0.0/roadsigns-4.0.0-sources.jar.
  
     &gt; A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
        &gt; A dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) does
          not specify an aarFormatVersion value, which is a required value.
          Dependency: info.metadude.kotlin.library.roadsigns:roadsigns:4.0.0.
          AAR metadata file: /home/USERNAME/.m2/repository/info/metadude/kotlin/library/roadsigns/roadsigns/4.0.0/roadsigns-4.0.0.aar.
  </code></pre>
  <h1>Context information</h1>
  <p>When I try the same with Gradle 5.6.4 then there is <strong>no error</strong>.</p>
  <p>In the Android Kotlin library I am using:</p>
  <ul>
  <li><a href="https://github.com/wupdigital/android-maven-publish" rel="noreferrer">digital.wup:android-maven-publish:3.6.3</a></li>
  <li><a href="https://github.com/bintray/gradle-bintray-plugin" rel="noreferrer">com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5</a></li>
  </ul>
  <p>I using <em>Java 8 (OpenJDK)</em> on my machine and verified that the same error occurs on a different computer.</p>
  <h1>Experiments</h1>
  <ul>
  <li>When I deploy the library with Gradle 5 and build the app with Gradle 5 or Gradle 6 in both cases it works.</li>
  </ul>
  <h1>The question</h1>
  <p>What changed from Gradle 5 to Gradle 6 which causes the <em>aar</em> to be broken (?)</p>
  <h1>Findings</h1>
  <ul>
  <li><p>I took a look at the files being deployed in <code>mavenLocal()</code>:</p>
  <p>~/.m2/repository/info/metadude/kotlin/library/roadsigns<br />
  └── roadsigns<br />
  ├── 4.0.0<br />
  │   ├── roadsigns-4.0.0.aar<br />
  │   ├── roadsigns-4.0.0-javadoc.jar<br />
  │   ├── roadsigns-4.0.0.module<br />
  │   ├── roadsigns-4.0.0.pom<br />
  │   └── roadsigns-4.0.0-sources.jar<br />
  └── maven-metadata-local.xml</p>
  </li>
  <li><p>I compared the files deployed with Gradle 5 and Gradle 6. Interestingly, the <code>roadsigns-4.0.0.aar</code> files are binary equivalent. The <code>pom</code> file differs, though:</p>
  <p><a href="https://i.stack.imgur.com/DL6hI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DL6hI.png" alt="Diff of roadsigns-4.0.0.pom files" /></a></p>
  </li>
  <li><p>Also there is a <code>roadsigns-4.0.0.module</code> file only when I deploy with Gradle 6.</p>
  </li>
  <li><p>When I <strong>manually</strong> remove the &quot;new&quot; <code>do_not_remove: published-with-gradle-metadata</code> part from the file deployed with Gradle 6 then the app builds <strong>successfully</strong>! The question remains ... what's going on here?!</p>
  </li>
  </ul>