Bump Glide compileSdkVersion to 37 and Robolectric to 4.16#5702
Open
copybara-service[bot] wants to merge 1 commit into
Open
Bump Glide compileSdkVersion to 37 and Robolectric to 4.16#5702copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
1d6b710 to
a7139ef
Compare
a7139ef to
f91211e
Compare
Bumping compileSdkVersion to 37 is required to resolve issues with dependencies (such as `androidx.core:core` and `core-ktx` version `1.19.0`) that require compilation against API 37 or later. This SDK bump triggers compilation failures in Robolectric tests across multiple modules: "error: cannot access FingerprintManager ... class file for android.hardware.fingerprint.FingerprintManager not found" This happens because `FingerprintManager` was removed in newer Android SDKs, but Robolectric's `Shadows` class (even in newer versions like 4.16) still contains references to it. During compilation of any test using `Shadows` (even those not using fingerprint features), the Java compiler attempts to resolve all method signatures in the `Shadows` class to perform overload resolution, failing because `FingerprintManager` is missing from the classpath. To resolve this cleanly without introducing stubs, this CL: 1. Bumps Robolectric to 4.16 to ensure better compatibility with the new SDK. 2. Introduces a `CustomShadows` helper class in `:testutil` that provides `shadowOf` overloads using `Shadow.extract` instead of referencing `org.robolectric.Shadows`. This avoids pulling in the missing `FingerprintManager` reference at compile time. 3. Adds a Robolectric dependency to the `:testutil` module so it can host the `CustomShadows` helper. 4. Refactors all tests across all modules (including `:library:test`, `:third_party:gif_decoder`, and `:integration:sqljournaldiskcache`) to use `CustomShadows.shadowOf` (or avoid `Shadows` entirely where redundant), allowing the entire project to compile cleanly against `compileSdk 37` without needing any Android framework stubs. 5. Fixes some existing Error Prone `TestExceptionChecker` warnings in `RequestManagerRetrieverTest` that were triggered during recompilation. PiperOrigin-RevId: 928612579
f91211e to
70b6434
Compare
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.
Bump Glide compileSdkVersion to 37 and Robolectric to 4.16
Bumping compileSdkVersion to 37 is required to resolve issues with dependencies (such as
androidx.core:coreandcore-ktxversion1.19.0) that require compilation against API 37 or later.This SDK bump triggers compilation failures in Robolectric tests across multiple modules:
"error: cannot access FingerprintManager ... class file for android.hardware.fingerprint.FingerprintManager not found"
This happens because
FingerprintManagerwas removed in newer Android SDKs, but Robolectric'sShadowsclass (even in newer versions like 4.16) still contains references to it. During compilation of any test usingShadows(even those not using fingerprint features), the Java compiler attempts to resolve all method signatures in theShadowsclass to perform overload resolution, failing becauseFingerprintManageris missing from the classpath.To resolve this cleanly without introducing stubs, this CL:
CustomShadowshelper class in:testutilthat providesshadowOfoverloads usingShadow.extractinstead of referencingorg.robolectric.Shadows. This avoids pulling in the missingFingerprintManagerreference at compile time.:testutilmodule so it can host theCustomShadowshelper.:library:test,:third_party:gif_decoder, and:integration:sqljournaldiskcache) to useCustomShadows.shadowOf(or avoidShadowsentirely where redundant), allowing the entire project to compile cleanly againstcompileSdk 37without needing any Android framework stubs.TestExceptionCheckerwarnings inRequestManagerRetrieverTestthat were triggered during recompilation.