fix: Downgrade androidx.metrics dep to beta01 in Gradle build#149
Merged
Conversation
refs: RUM-10762
0xnm
approved these changes
Jul 10, 2025
Contributor
Author
|
CI jobs for this PR were routinely failing due to an unrelated flaw in the CI scripts (in short: writing subprocess output to stdout asynchronously can raise Bypassing checks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refs: RUM-10762
What and why?
As explained in RUM-10762, Android builds are broken on Unity 2022 and older, due to a transitive dependency included by
dd-sdk-android-rum: namely,androidx.metrics:metrics-performance. As of version1.0.0-beta02, that library requires an Android Gradle plugin version of 8.6.0 or newer (while versions of Unity prior to Unity 6 are stuck on AGP 7.x). The prior version,1.0.0-beta01, is compatible with AGP 7.This PR adds a
IPostGenerateGradleAndroidProjectcallback to Unity Android builds. That callback, implemented asDatadogGradlePostProcessor, does the following:gradle.build.gradle.buildfile after it's been modified by EDM4U.dd-sdk-android-rumas a dependency within that section. If we can find no such declaration, we return here and make no changes.implementationspecifier fordd-sdk-android-rumwith one that explicitly excludesandroidx.metrics:metrics-performance, preserving the existing version specifier fordd-sdk-android-rumimplementationspecifier that explicitly pulls inandroidx.metrics:metrics-performanceat the desired (older) versionI've also added tests to cover these cases.
The net result is that after EDM4U generates a
build.gradlefile containing thisdependenciesblock:...we will further modify it to:
This unblocks Android Unity builds, at the cost of using an older version of
androidx.metrics:metrics-performance.The net effect of this fix is similar to the fix employed for dd-sdk-reactnative: it's simply a bit more complicated to execute since the
build.gradlefile is generated by Unity (and post-processed by EDM4U) on a per-project basis.Review checklist