Avoid referencing resource names within Resource Loader by benjaminRomano · Pull Request #5388 · bumptech/glide
I tried to build locally, but I'm hitting the following error when running ./gradlew jar:
* What went wrong:
A problem occurred configuring root project 'glide-parent'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve androidx.benchmark:benchmark-gradle-plugin:1.2.0-beta05.
Required by:
project :
> No matching variant of androidx.benchmark:benchmark-gradle-plugin:1.2.0-beta05 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.3' but:
- Variant 'apiElements' capability androidx.benchmark:benchmark-gradle-plugin:1.2.0-beta05 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
- Variant 'runtimeElements' capability androidx.benchmark:benchmark-gradle-plugin:1.2.0-beta05 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
- Variant 'sourcesElements' capability androidx.benchmark:benchmark-gradle-plugin:1.2.0-beta05 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
To be extra safe, would it be possible for you to flag guard this change, roll it out in your binary, verify there are no issues, and then clean-up the flag?
I'm OK with wiring an experiment if need be, but it's likely unnecessary precautions.
The content URI format being used has been around since Cupcake (ref): https://developer.android.com/reference/android/content/ContentResolver#the-android.resource-scheme_android_resource-scheme
The equivalent code in AOSP can be found here: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/ContentResolver.java;l=1499?q=SCHEME_ANDROID_RESOURCE
Tracing the AOSP source code, it can be verified that migrating the the new content URI scheme is safe. Effectively, ContentResolver is undoing the conversion from resourceID to resourceName that glide is doing today here. My change removes this unnecessary conversion and resource access through reflection (getIdentifier).
About a month or two ago, we migrated all our content URIs to the new format for Snapchat and did not encounter any issues as expected.
Can you squash this commit with your other commits?
I can do this once I've addressed all comments, but you'll also be able to squash merge my commits and re-write the commit messages when you merge changes through Github.