Skip to content

fix(🤖): build the Android library at its API 26 floor and raise an Expo app to it - #556

Merged
wcandillon merged 5 commits into
wcandillon:mainfrom
YevheniiKotyrlo:fix/android-min-sdk-floor
Oct 16, 2026
Merged

wcandillon merged 5 commits into
wcandillon:mainfrom
YevheniiKotyrlo:fix/android-min-sdk-floor

Conversation

@YevheniiKotyrlo

@YevheniiKotyrlo YevheniiKotyrlo commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #554.

Problem

An Expo app's Android build fails in the library's C++: Expo sets minSdkVersion 24, the library builds at the app's value, and its native code calls the AHardwareBuffer API, which Android 8 (API 26) introduced. Wgpu_minSdkVersion=26 never reaches an app: android/gradle.properties is not in the published files.

Solution

  • android/build.gradle builds the library at the higher of the app's minSdkVersion and androidMinSdkVersion, a new package.json field (26), so an app below 26 stops at the manifest merger with Android's suggestion to raise its minSdk instead of at the compiler. The unused Wgpu_minSdkVersion goes.
  • The config plugin raises an Expo app's android.minSdkVersion Gradle property to that floor and keeps a higher value, so an Expo app with the plugin, the template included, builds with Expo's defaults.
  • The installation and Canvas pages state the minimum, and the Expo page and CONTRIBUTING.md describe the plugin's step on each platform.

Tests

plugin/src/__tests__/setMinSdkVersion.test.ts: the property is added, a lower value raised in place, a higher one kept, the change idempotent.

Verification

  • The example with react.minSdkVersion=24: before, :react-native-webgpu:externalNativeBuildDebug fails with 'AHardwareBuffer_describe' is unavailable: introduced in Android 26 and the same error for every other AHardwareBuffer call; after, :app:processDebugMainManifest fails with uses-sdk:minSdkVersion 24 cannot be smaller than version 26 declared in library [:react-native-webgpu].
  • apps/expo-webgpu with this branch packed and installed as npm would: npx expo prebuild --platform android writes android.minSdkVersion=26, and ./gradlew assembleDebug succeeds; with the published 0.8.5, ./gradlew assembleRelease there fails with the errors above.
  • yarn lint · yarn tsc · the package and web-template builds · yarn test:plugin · yarn check-dawn · yarn build:docs · npm run cpplint merged with main (this branch changes no C++ file).

…po app to it

An Expo app's Android build failed in the library's C++: Expo sets
minSdkVersion 24, the library built at the app's value, and its native
code calls the AHardwareBuffer API, which Android 8 (API 26) introduced.
Wgpu_minSdkVersion only applied to an app that sets no minSdkVersion.

android/build.gradle now builds the library at the higher of the app's
minSdkVersion and Wgpu_minSdkVersion, so an app below 26 stops at the
manifest merger with Android's suggestion to raise its minSdk. The config
plugin raises an Expo app's android.minSdkVersion to that floor, read from
android/gradle.properties, and keeps a higher value, so an Expo app with
the plugin builds with Expo's defaults. The installation, Expo and Canvas
pages state the minimum.

Fixes wcandillon#554
@wcandillon
wcandillon self-requested a review October 16, 2026 11:46

@wcandillon wcandillon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can you update the documentation to make it clear that the expo plugin is not iOS only now and it looks like the PR is marked as draft?

The Expo page still called the plugin a no-op on Android. It now lists
each platform's step: Metal API Validation off in the iOS scheme, the
app's minSdkVersion raised to 26 on Android. Both are re-applied on
every prebuild.
@YevheniiKotyrlo
YevheniiKotyrlo marked this pull request as ready for review October 16, 2026 12:08
@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor Author

Updated the Expo page and CONTRIBUTING.md to say what the plugin does on each platform: Metal API Validation off in the iOS scheme, minSdkVersion raised to 26 on Android. I also merged main and marked the PR ready for review. The one cpplint error, GPUNativeBufferWrapper.h:93, is on main too.

@wcandillon
wcandillon self-requested a review October 16, 2026 17:29
@wcandillon
wcandillon merged commit 8f664fc into wcandillon:main Oct 16, 2026
5 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.16.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: the library does not compile at an Expo app's default minSdkVersion (24)

2 participants