No longer able to use bundleReleaseAar in MavenPublication
Short Answer :
You need to enclose the publishing {} block inside a project.afterEvaluate as follows:
project.afterEvaluate {
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact bundleReleaseAar
//artifact sourcesJar
//artifact packageJavadoc
}
}
}
}
Long Answer :
Prior to gradle version 4.8, publishing block was implicitly treated as if all the logic inside it was executed after the project was evaluated. This was only block that behaved this way and this behavior was discontinued post gradle version 4.8 for consistency's sake. bundleReleaseAar task seems to be available only after project evaluation is complete and therefore to maintain behavior it must be explicitly enclosed inside project.afterEvaluate{}
Reference : https://docs.gradle.org/current/userguide/upgrading_version_4.html#rel4.8:deferred_configuration
I fix this problem change artifact from:
artifact bundleReleaseAar
to:
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
this help me Gradle sync success, but i must call assembleRelease directly, before ./gradlew publish