-
Notifications
You must be signed in to change notification settings - Fork 111
Description
- I have updated Purchases SDK to the latest version
- I have read the Contribution Guidelines
- I have searched the Community
- I have read docs.revenuecat.com
- I have searched for existing Github issues
Describe the bug
Apps that use react-native-purchases on Google Play (without Amazon Store) get a transitive play-services-mlkit-barcode-scanning dependency pulled into the APK. This registers GmsBarcodeScanningDelegateActivity in the merged AndroidManifest.
Google Play's automated pre-launch testing discovers this activity and tries to launch it, producing a fatal ActivityNotFoundException that appears in crash reporting (Sentry) and the Play Console pre-launch report.
-
Environment
- Platform: Android
- SDK version: react-native-purchases 9.10.3
- OS version: Android 11 (OnePlus 8 Pro — Google Play automated pre-launch crawler)
- Xcode/Android Studio version: N/A
- React Native version: 0.76.9 (Expo SDK 52)
- SDK installation: Expo autolinking
- How widespread is the issue: Affects all Android apps using react-native-purchases that don't use Amazon Store. The crash itself only appears during Google Play's automated pre-launch testing (not real users), but it pollutes crash reports and pre-launch results.
-
Debug logs
Not applicable — this is not a runtime issue in the app. It's an
ActivityNotFoundExceptiontriggered by Google Play's automated crawler trying to launch an activity that was registered in the merged AndroidManifest by the transitive barcode scanning dependency.Fatal Exception: android.content.ActivityNotFoundException Unable to find explicit activity class {com.example.myapp/com.google.android.gms.vision.barcode.ui.GmsBarcodeScanningDelegateActivity}; have you looked in your output AndroidManifest.xml? -
Steps to reproduce
- Create a React Native app using
react-native-purchasestargeting Google Play only (no Amazon Store) - Build a release APK/AAB
- Upload to Google Play (or inspect the merged AndroidManifest)
- Google Play's pre-launch testing discovers
GmsBarcodeScanningDelegateActivityin the manifest and tries to launch it - Expected: No barcode scanning activity in the manifest since the app doesn't use barcode scanning
- Actual: The activity is registered because
play-services-mlkit-barcode-scanningis pulled in transitively
- Create a React Native app using
-
Other information
Dependency chain:
react-native-purchases (9.10.3) └─ purchases-hybrid-common (17.41.0) └─ purchases-store-amazon (api() — transitive to consumers) └─ amazon-appstore-sdk (3.0.5) └─ com.google.android.gms:play-services-mlkit-barcode-scanning └─ com.google.mlkit:barcode-scanningThe root cause is in
purchases-hybrid-common'shybridcommon/build.gradle.kts, which declares the Amazon store module as anapi()dependency:"bc8Api"(libs.purchases.amazon.bc8) "bc7Api"(libs.purchases.amazon.bc7)
This makes the entire Amazon Store dependency tree (including ML Kit barcode scanning via
amazon-appstore-sdk) transitive to all consumers, even those only publishing to Google Play.Workaround — in the app's
android/app/build.gradle:configurations.all { exclude group: 'com.google.android.gms', module: 'play-services-mlkit-barcode-scanning' exclude group: 'com.google.mlkit', module: 'barcode-scanning' }
Suggested fix options:
- Exclude barcode scanning in
purchases-hybrid-commonif the Amazon Store module doesn't actually use it - Switch the Amazon Store dependency from
api()toimplementation()so it doesn't leak transitively — apps that need Amazon Store can add it explicitly - At minimum, document the workaround for apps that only target Google Play
- Exclude barcode scanning in
Additional context
The crash is not user-facing — it only occurs during Google Play's automated pre-launch testing, which discovers all registered activities in the merged AndroidManifest and attempts to launch them. However, it pollutes crash reports and may cause concern when reviewing pre-launch results in the Play Console.