Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 1.31 KB

aar_mavenlocal_gradle6_error.md

File metadata and controls

18 lines (15 loc) · 1.31 KB

Unable to resolve the aar dependencie from mavenLocal() on Gradle 6.0+

Starting from Gradle 6.0+, the maven-publish plugin adds the function Gradle Module MetadataClick me to view the official documentation of Gradle Module Metadata). This function will add a file with the suffix .module to the released package. This file is used to describe the library like Maven's pom file, except that .module is dedicated to Gradle.

After actual measurement, when the local maven package contains .module file, The jar package can always resolve dependencies, And the aar package cannot resolve dependencies since 6.0, and Gradle does not report an error. Fortunately, the official documentation provides a configuration method to prohibit the generation of .module files, as follows:

tasks.withType(GenerateModuleMetadata) {
    enabled = false
}

If you use Kotlin DSL use:

tasks.withType<GenerateModuleMetadata> {
    enabled = false
}

After adding this configuration, you need to delete the existing package in the local mavenLocal(), and then repackage it. Because although there is no .module file in the new package, the previous .module file will not be deleted