RevenueCat / RevenueCat/react-native-purchases

Transitive ML Kit barcode scanning dependency causes false crashes in Google Play pre-launch testing

Open
#1,621 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

acknowledged
Dominant language
TypeScript
Stars
1.2k
Forks
117
Avg merge
14h 40m
Merged PRs (30d)
40

Description

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.

  1. Environment

    1. Platform: Android
    2. SDK version: react-native-purchases 9.10.3
    3. OS version: Android 11 (OnePlus 8 Pro — Google Play automated pre-launch crawler)
    4. Xcode/Android Studio version: N/A
    5. React Native version: 0.76.9 (Expo SDK 52)
    6. SDK installation: Expo autolinking
    7. 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.
  2. Debug logs

    Not applicable — this is not a runtime issue in the app. It's an ActivityNotFoundException triggered 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?
    
  3. Steps to reproduce

    1. Create a React Native app using react-native-purchases targeting Google Play only (no Amazon Store)
    2. Build a release APK/AAB
    3. Upload to Google Play (or inspect the merged AndroidManifest)
    4. Google Play's pre-launch testing discovers GmsBarcodeScanningDelegateActivity in the manifest and tries to launch it
    5. Expected: No barcode scanning activity in the manifest since the app doesn't use barcode scanning
    6. Actual: The activity is registered because play-services-mlkit-barcode-scanning is pulled in transitively
  4. 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-scanning
    

    The root cause is in purchases-hybrid-common's hybridcommon/build.gradle.kts, which declares the Amazon store module as an api() 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:

    1. Exclude barcode scanning in purchases-hybrid-common if the Amazon Store module doesn't actually use it
    2. Switch the Amazon Store dependency from api() to implementation() so it doesn't leak transitively — apps that need Amazon Store can add it explicitly
    3. At minimum, document the workaround for apps that only target Google Play

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting hybridcommon/build.gradle.kts in purchases-hybrid-common and the dependency chain through purchases-store-amazon and amazon-appstore-sdk. Reproduce or inspect the merged AndroidManifest and dependency graph for a Google Play-only app. Done means the unwanted barcode-scanning activity is no longer exposed transitively, while the issue's Amazon Store compatibility requirements are addressed or documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, react-native
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.