Skip to content

Fixes build after androidx.xr.compose:compose update to 1.0.0-alpha11#203

Open
wintezz wants to merge 2 commits intoandroid:mainfrom
wintezz:fix/androidify-195-build
Open

Fixes build after androidx.xr.compose:compose update to 1.0.0-alpha11#203
wintezz wants to merge 2 commits intoandroid:mainfrom
wintezz:fix/androidify-195-build

Conversation

@wintezz
Copy link

@wintezz wintezz commented Mar 4, 2026

Problem:
The update to alpha11 introduced breaking changes:

  1. SpatialConfiguration and SpatialCapabilities became sealed interfaces, making custom implementations impossible
  2. The bug b/441901724 (Preview crashing on XR CompositionLocal access) i think is fixed in the library

Solution:
Removed all custom implementations:

  • HasSpatialFeatureSpatialConfiguration
  • SupportsFullSpaceModeRequestCapabilities
  • NoSpatialCapabilities
  • LacksSpatialFeatureSpatialConfiguration

Removed workarounds:

  • LocalSpatialCapabilities
  • LocalSpatialConfiguration
  • LocalSession

Removed SupportsFullSpaceModeRequestProvider
Switched to using official androidx.xr.compose.platform

Result

  • Build succeeds with alpha11
  • Previews work out of the box (no crashes, no workarounds)

Related PR:
#195

@wintezz wintezz requested review from riggaroo and tiwiz as code owners March 4, 2026 19:38
@google-cla
Copy link

google-cla bot commented Mar 4, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on adapting the project to the breaking changes introduced by the androidx.xr.compose:compose 1.0.0-alpha11 update. The primary goal was to fix the build and enable previews to work correctly by removing custom XR implementations and workarounds, and instead leveraging the official platform APIs. This ensures compatibility with the latest XR Compose library and streamlines the development experience for XR-enabled features.

Highlights

  • XR Compose Library Update: Updated the androidx.xr.compose:compose library to 1.0.0-alpha11, addressing breaking changes introduced in this version.
  • Removal of Custom XR Implementations: Eliminated custom implementations of SpatialConfiguration and SpatialCapabilities (e.g., HasSpatialFeatureSpatialConfiguration, SupportsFullSpaceModeRequestCapabilities, NoSpatialCapabilities, LacksSpatialFeatureSpatialConfiguration) which became impossible due to the new sealed interface definitions in alpha11.
  • Workaround Removal and Official API Adoption: Removed previous workarounds for XR CompositionLocals (LocalSpatialCapabilities, LocalSpatialConfiguration, LocalSession) and SupportsFullSpaceModeRequestProvider, switching to the official androidx.xr.compose.platform components. This also fixes preview crashes related to XR CompositionLocal access.
  • Dependency Updates: Performed a comprehensive update of various project dependencies, including Android Gradle Plugin (AGP), Compose BOM, CameraX, Coil, Firebase, Hilt, Kotlin, Material3, Media3, Navigation, OkHttp, Retrofit, Robolectric, Spotless, Wear Compose, and several Rust crates.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • core/xr/src/main/java/com/android/developers/androidify/xr/SpatialUiModes.kt
    • Imported official LocalSession, LocalSpatialCapabilities, and LocalSpatialConfiguration from androidx.xr.compose.platform.
  • core/xr/src/main/java/com/android/developers/androidify/xr/XrPreview.kt
    • Removed custom SupportsFullSpaceModeRequestProvider.
    • Deleted custom SpatialConfiguration and SpatialCapabilities implementations (HasSpatialFeatureSpatialConfiguration, SupportsFullSpaceModeRequestCapabilities, NoSpatialCapabilities, LacksSpatialFeatureSpatialConfiguration).
    • Removed workaround ProvidableCompositionLocal definitions for LocalSpatialCapabilities, LocalSpatialConfiguration, and LocalSession.
  • feature/camera/src/main/java/com/android/developers/androidify/camera/CameraLayout.kt
    • Updated the import for LocalSpatialCapabilities to use the official androidx.xr.compose.platform version.
  • feature/creation/src/main/java/com/android/developers/androidify/creation/EditScreenLayoutType.kt
    • Updated the import for LocalSpatialCapabilities to use the official androidx.xr.compose.platform version.
  • feature/creation/src/main/java/com/android/developers/androidify/creation/xr/EditScreenHomeSpaceModePreviews.kt
    • Removed the import and usage of SupportsFullSpaceModeRequestProvider from preview composables.
  • feature/home/src/main/java/com/android/developers/androidify/home/HomeScreenMedium.kt
    • Removed the import and usage of SupportsFullSpaceModeRequestProvider.
  • feature/home/src/main/java/com/android/developers/androidify/home/xr/HomeScreenHomeSpaceModePreviews.kt
    • Removed the import and usage of SupportsFullSpaceModeRequestProvider from preview composables.
  • feature/results/src/main/java/com/android/developers/androidify/results/ResultsLayoutType.kt
    • Updated the import for LocalSpatialCapabilities to use the official androidx.xr.compose.platform version.
  • gradle/init.gradle.kts
    • Updated the spotlessVersion from 7.0.2 to 8.2.1.
  • gradle/libs.versions.toml
    • Updated agp to 9.0.1.
    • Updated extensionsXr to 1.2.0.
    • Updated activityCompose to 1.12.4.
    • Updated apksig to 9.0.1.
    • Updated baselineprofile to 1.5.0-alpha03.
    • Updated camerax to 1.5.3.
    • Updated coilCompose and coilGif to 3.4.0.
    • Updated composeBom to 2026.02.01.
    • Updated converterGson to 3.0.0.
    • Updated coreSplashscreen to 1.2.0.
    • Updated datastore to 1.2.0.
    • Updated firebaseBom to 34.10.0.
    • Updated genaiPrompt to 1.0.0-beta1.
    • Updated googleOss to 17.4.0.
    • Updated guava to 33.5.0-jre.
    • Updated hiltAndroid to 2.59.2.
    • Updated kotlin to 2.3.10.
    • Updated ksp to 2.3.6.
    • Updated kotlinxSerialization, kotlinxSerializationJson, and kotlinxSerializationProtobuf to 2.3.10, 1.10.0, and 1.10.0 respectively.
    • Updated material3 to 1.5.0-alpha15.
    • Updated media3 to 1.9.2.
    • Updated navigation3 to 1.0.1.
    • Updated okhttp to 5.3.2.
    • Updated retrofit to 3.0.0.
    • Updated robolectric to 4.16.1.
    • Updated spotless to 8.2.1.
    • Updated uiTextGoogleFonts to 1.10.4.
    • Updated uiautomator to 2.4.0-beta01.
    • Updated uiTooling to 1.10.4.
    • Updated wear to 1.4.0.
    • Updated wearCompose to 1.6.0-beta01.
    • Updated wearRemoteInteractions to 1.2.0.
    • Updated window to 1.5.1.
    • Updated lifecycleProcess to 2.10.0.
    • Updated playServicesBase to 18.10.0.
    • Updated workRuntimeKtx to 2.11.1.
    • Updated xr-compose to 1.0.0-alpha11.
  • gradle/wrapper/gradle-wrapper.properties
    • Updated the Gradle distribution URL to gradle-9.3.1-bin.zip.
  • watchface/pack-java/Cargo.lock
    • Updated android_logger from 0.13.3 to 0.15.1.
    • Removed cesu8 package.
    • Replaced env_logger with env_filter and updated its version.
    • Updated jni from 0.21.1 to 0.22.2 and adjusted its dependencies.
    • Added jni-macros and jni-sys-macros packages.
    • Updated jni-sys from 0.3.0 to 0.4.1.
    • Updated log from 0.4.27 to 0.4.29.
    • Added rustc_version and semver packages.
    • Added simd_cesu8 and simdutf8 packages.
    • Updated thiserror and thiserror-impl from 1.0.69 to 2.0.18.
    • Updated windows-link from 0.1.3 to 0.2.1.
    • Removed specific version numbers from windows-sys dependencies where applicable.
  • watchface/pack-java/Cargo.toml
    • Updated jni dependency to 0.22.0.
    • Updated android_logger dependency to 0.15.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/build_and_test.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully updates androidx.xr.compose to 1.0.0-alpha11 and addresses the resulting breaking changes. The changes primarily involve removing custom implementations and workarounds for SpatialConfiguration and SpatialCapabilities, which are now unnecessary. A significant number of dependencies have also been updated across the project, including Gradle, Spotless, and various AndroidX and third-party libraries. The code is now cleaner and relies on the official platform APIs. My review identified one potential issue regarding the update of the Guava dependency from the -android to the -jre artifact, which could have implications for Android compatibility.

googleOssPlugin = "0.10.10"
guava = "33.5.0-android"
hiltAndroid = "2.59"
guava = "33.5.0-jre"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The Guava dependency has been changed from the -android artifact to the -jre artifact. The -jre artifact is intended for general Java projects and may contain APIs not available on all Android versions, which can lead to runtime crashes on older devices if core library desugaring is not correctly configured. For Android projects, it is recommended to use the -android artifact, which is specifically tailored for Android compatibility. If this change is not required by another dependency update, consider reverting to the -android artifact.

Suggested change
guava = "33.5.0-jre"
guava = "33.5.0-android"

Copy link
Author

Choose a reason for hiding this comment

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

it's was before my pull request

- Remove custom implementations of sealed interfaces SpatialConfiguration and SpatialCapabilities
- Delete workaround composition locals for Preview (fixed in library)
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.

1 participant