Skip to main content
Question

Paywalls require your activity to subclass FlutterFragmentActivity

  • October 21, 2024
  • 1 reply
  • 146 views

Forum|alt.badge.img+1

Added this packages:

purchases_flutter: ^8.1.6purchases_ui_flutter: ^8.1.6

 

Error:

 Purchases instance already set with the same configuration. Ignoring duplicate call.
D/[Purchases] - DEBUG(21300): ℹ️ Listener set
E/PurchasesUIFlutter(21300): Paywalls require your activity to subclass FlutterFragmentActivity
I/flutter (21300): ----------------FIREBASE CRASHLYTICS----------------
I/flutter (21300): PlatformException(0, Make sure your MainActivity inherits from FlutterFragmentActivity, null, null)
I/flutter (21300): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7)
I/flutter (21300): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
I/flutter (21300): <asynchronous suspension>
I/flutter (21300): #2      RevenueCatUI.presentPaywallIfNeeded (package:purchases_ui_flutter/purchases_ui_flutter.dart:41:20)
I/flutter (21300): <asynchronous suspension>
I/flutter (21300): #3      _configureSDK (package:english_booster/main.dart:79:5)
I/flutter (21300): <asynchronous suspension>
I/flutter (21300): #4      main (package:english_booster/main.dart:67:3)
I/flutter (21300): <asynchronous suspension>

 

main.dart code:

Future<void> _configureSDK() async {  await Purchases.setLogLevel(LogLevel.debug);  PurchasesConfiguration? configuration;  if (Platform.isAndroid) {    configuration = PurchasesConfiguration(googleApiKey);  }  if(configuration !=null) {    await Purchases.configure(configuration);    await RevenueCatUI.presentPaywallIfNeeded(entitlementID);  }}

 

Tested api level: 33, 35. But didn’t working. 

This post has been closed for comments

1 reply

kaitlin
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 401 replies
  • October 23, 2024

Hi @md-mafujul-islam-809ce9,

I see this message at the very top of your logs: `Purchases instance already set with the same configuration. Ignoring duplicate call.`

This indicates that you’re configuring the SDK twice, which can cause a variety of issues. If the code snippet that you shared is the second time you’re configuring an instance of Purchases, it does look like it is being ignored.

My recommendation would be to check that you only configure the SDK once, and to move `presentPaywallIfNeeded` out of your configuration block. We have some code samples for presenting your Flutter Paywall here: https://www.revenuecat.com/docs/tools/paywalls/displaying-paywalls#flutter


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings