RevenueCat / purchases-android

Android in-app purchases and subscriptions made easy.
https://www.revenuecat.com/
MIT License
253 stars 51 forks source link

[Amazon] Target SDK 12 - build error about android:exported missing in merged maniphest #397

Closed mikezliu closed 2 years ago

mikezliu commented 2 years ago

Describe the bug When trying to compile with target SDK 31 (Android 12) with the amazon revenuecat gradle dependencies, there is a build error about the merged maniphest missing android:export

.../app/src/main/AndroidManifest.xml Error:
    android:exported needs to be explicitly specified for <receiver>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
  1. Environment
    1. Platform: Mac / Android
    2. SDK version: 5.0.0-amazon.alpha.3
    3. OS version: Monterrey
    4. Android Studio version: 20.3.1
    5. How widespread is the issue. Percentage of devices affected. 100%
  2. Debug logs that reproduce the issue
  3. Steps to reproduce, with a description of expected vs. actual behavior
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context Add any other context about the problem here.

codykerns commented 2 years ago

Hey @mikezliu! Can you send over the receiver entry in the merged AndroidManifest.xml that is failing? It looks like this is a requirement for Android 12: https://stackoverflow.com/a/68648841

mikezliu commented 2 years ago
        <receiver
            android:name="com.amazon.device.iap.ResponseReceiver"
            android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" >
            <intent-filter>
                <action android:name="com.amazon.inapp.purchasing.NOTIFY" />
            </intent-filter>
        </receiver>

You could also set targetSDK to 31 on your sample project to see the error

codykerns commented 2 years ago

Hey @mikezliu! Thanks for the heads up- are you able to manually modify the entry to include the exported property? Like:

        <receiver
            android:name="com.amazon.device.iap.ResponseReceiver"
            android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" 
            android:exported="true">
            <intent-filter>
                <action android:name="com.amazon.inapp.purchasing.NOTIFY" />
            </intent-filter>
        </receiver>

I've went ahead and logged this as a bug on our end. We'll update this issue when we have more information on a fix.

mikezliu commented 2 years ago

For now I've set compile SDK to 31, and target SDK to 30, since most amazon devices don't support SDK 31 yet

beylmk commented 2 years ago

Hey @mikezliu this should be fixed in the latest amazon alpha release, 5.0.0-amazon.alpha.4. I'm going to close this ticket for now, but feel free to re-open if you're still experiencing issues.

github-actions[bot] commented 2 years ago

This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.