Fix sources and javadoc generation for AGP 9.0 compatibility#157
Conversation
Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
…e.txt Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
getBootClasspath() with AGP 7+ API
Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
…ove removed gradle property Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
…h instead Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
getBootClasspath() with AGP 7+ API|
@copilot Why is so much additional logic necessary for the javadoc task? How do modern projects handle this? Are there better and less verbose ways to generate javadoc? |
…g API Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
The verbose manual approach was unnecessary. AGP 4.1+ provides Simplified in bafbdc4: removed the entire publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}The |
bef5cd6
into
dependabot/gradle/com.android.tools.build-gradle-9.0.1
* Bump com.android.tools.build:gradle from 8.13.2 to 9.0.1 Bumps com.android.tools.build:gradle from 8.13.2 to 9.0.1. --- updated-dependencies: - dependency-name: com.android.tools.build:gradle dependency-version: 9.0.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Fix sources and javadoc generation for AGP 9.0 compatibility (#157) * Initial plan * Update Gradle wrapper to 9.1.0 as required by AGP 9.0.1 Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> * Replace deprecated proguard-android.txt with proguard-android-optimize.txt Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> * Fix getBootClasspath() compatibility with AGP 7+ Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> * Fix javadoc boot classpath for AGP 9 compatibility Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> * Fix AGP 9 compatibility: boot classpath via env/local.properties, remove removed gradle property Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> * Fix AGP 9: remove android.libraryVariants, use releaseCompileClasspath instead Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> * Fix javadoc: update compileSdk to 34 and set failOnError=false Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> * Simplify javadoc/sources generation using AGP singleVariant publishing API Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Acconut <1375043+Acconut@users.noreply.github.com>
AGP 9.0 removed several APIs previously used for sources and javadoc generation, causing project configuration to fail on every Gradle invocation (including
assembleandcheck).Changes
afterEvaluateblock (which relied on removed APIsandroid.getBootClasspath(),android.libraryVariants, andandroid.sdkDirectory) with AGP's built-inandroid.publishing.singleVariantAPI. AGP handles task creation and SDK classpath resolution internally:Sources and javadoc are now automatically included in the
releasecomponent and picked up byfrom components.releasein the Maven publication.compileSdk 33 → 34: android-33 platform is not present on the CI runner; android-34 is (consistent withexample/build.gradlewhich already targets API 34).gradle.properties: Removedandroid.defaults.buildfeatures.buildconfig=false, which was removed in AGP 9.0 and caused a deprecation warning.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.