Sunday, 14 October 2018

Application build fails after migrating library build to Gradle 4.5.1

I have an application that uses library A that was converted to build with Gradle 4.5.1 (from 3.5.1). Library A in turn depends on library B that was also converted to use Gradle 4.5.1.

The application build now fails when attempting to build with library A (it does not directly include a dependency to library B). The build error is a resource not found error against resources from library B.

application:

dependencies {
    implementation('com.example:libraryA:version@aar') {
        transitive = true
    }
}

library A:

dependencies {
    implementation 'com.example:libraryB:version@aar'
}

If I directly include library B in the dependencies of the application, then the build works, however I don't want to do that because I don't want to specify the dependencies of library A in the application and I don't want to have to keep updating the version of library B as the version used by A is incremented.

It also builds if I use the compile directive instead of implementation, however, I don't want to do that because compile is going to be obsoleted. Also, using api doesn't appear to address the problem.

How can I get the build to work without needing to specify the dependencies of library A?



from Application build fails after migrating library build to Gradle 4.5.1

No comments:

Post a Comment