Skip to content

Conversation

@agrognetti
Copy link

@agrognetti agrognetti commented Nov 25, 2025

Upgraded Android Gradle Plugin, Gradle wrapper, and dexcount plugin versions. Migrated all modules to use compileSdk 34 and targetSdk 34, added namespace declarations, and updated build configuration to match latest Gradle and Android standards. Improved build script structure and fixed deprecation warnings for Gradle tasks.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Describe the solution you've provided
Upgrade gradle from 7.3.3 version to 8.5.0

Additional context
I wanted to build the project to check something, but I was asked to upgrade the gradle version to 8.x.x and I thought it was a good idea to push the change.
I haven't tested it extensively since this is out of the scope of my tickets, but it seems to work correctly. @tanderson-ld check it a bit more before approve it please.


Note

Upgrade build system to Gradle 8.5/AGP 8.3.2 and migrate all modules to compile/target SDK 34 with namespace and modern Gradle/Android DSL updates, plus test/proguard tweaks and a receiver fix for Android 13+.

  • Build system:
    • Upgrade Gradle wrapper to 8.5, Android Gradle Plugin to 8.3.2, dexcount to 4.0.0, and Nexus Publish plugin to 1.3.0.
    • Refactor root build.gradle: use base.archivesName, centralize Android config via BaseExtension, enable deprecation checks, and add test JVM --add-opens.
  • Android SDK/config:
    • Migrate all modules to compileSdk/targetSdk 34, add namespace, switch to new minSdk/compileSdk DSLs, remove buildToolsVersion.
    • Update manifests and activities (add android:exported where needed); switch to new packaging { resources { excludes } } and publishing { singleVariant("release") }.
  • Javadoc & publishing:
    • Rewrite Javadoc/sources tasks using lazy task registration; add Android boot classpath and BuildConfig generation deps; update artifact publication to new APIs.
  • Testing & dependencies:
    • Bump AndroidX test libraries and orchestrator; add ProGuard rules in example and contract-tests; exclude error_prone_annotations to avoid dexing issues.
  • Runtime:
    • On Android 13+, register connectivity BroadcastReceiver with Context.RECEIVER_NOT_EXPORTED in AndroidPlatformState.

Written by Cursor Bugbot for commit cd3320f. This will update automatically on new commits. Configure here.

Upgraded Android Gradle Plugin, Gradle wrapper, and dexcount plugin versions. Migrated all modules to use compileSdk 34 and targetSdk 34, added namespace declarations, and updated build configuration to match latest Gradle and Android standards. Improved build script structure and fixed deprecation warnings for Gradle tasks.
@agrognetti agrognetti requested a review from a team as a code owner November 25, 2025 20:49
@agrognetti agrognetti changed the title Update to Android Gradle Plugin 8.3.2 and SDK 34 chore: Update to Android Gradle Plugin 8.3.2 and SDK 34 Nov 25, 2025
Added ProGuard rules to contract-tests and example modules to suppress warnings for error-prone annotations. Improved build.gradle files to support reflection for tests and enhanced Javadoc generation with proper boot classpath handling. Cleaned up AndroidManifest.xml files by removing explicit package attributes.
…d 13+

- remove obsolete package attribute from androidTest manifest (namespace comes from Gradle)
- register connectivity broadcast receiver with RECEIVER_NOT_EXPORTED on API 33+
- bump AndroidX test/orchestrator deps to 1.5.x/1.4.2 to satisfy receiver export requirement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bug?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but I updated the target SDK to 34 and it is required for apps targeting 34 and above. https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

classpath += bootClasspath
if (options instanceof StandardJavadocDocletOptions) {
options.bootClasspath = bootClasspath.files.toList()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What motivated these changes?

This seems a little magic

    if (options instanceof StandardJavadocDocletOptions) {
        options.source = "8"
    }

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We’re running the build (incl. Javadoc) on JDK 17 after the AGP/Gradle upgrade, since AGP 8 requires it, but the SDK still targets Java 8 bytecode/APIs (lines 51/52 build.gradle(android-client-sdk) to make it compatible with apps compiling with Java 8 + desugaring and minSdk 21.
Setting options.source = "8" makes Javadoc enforce Java 8 syntax so we don’t accidentally expose Java 9+ APIs. If we leave it at the default, Javadoc assumes 17.
If we raised the whole SDK to Java 17 would it make sense to drop this and align everything to 17, but doing that will require all the apps using this SDK to bump their Java versions to 17 which I think it's not currently recommendable.

The specific code snippet you mentioned it's saying to Javadoc that uses Java 8

buildTypes {
release {
minifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these proguard additions be eliminated? We want to avoid proguard in examples to focus on core functionality.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProGuard / R8 (Same thing, R8 is the new name) is enabled when minifyEnabled = true is set. So, R8 is currently enabled on the main branch.
I just added these lines because otherwise I get the error "Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in..." when I try to run ./gradlew assemble.

We could get rid of R8 in the example app, but given that most of the client apps use R8, I think leaving it enabled could catch possible issues that happen in our lib only when R8 is enabled.


publishing {
singleVariant("release")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check implications of this singleVariant. I don't think we used this before.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to avoid creating a Gradle "component" for the debug version, since it's not necessary given that later is discarded and only the "release" component is used. (Line 184).
https://developer.android.com/build/publish-library/configure-pub-variants#single-pub-var

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants