flutter-stripe / flutter_stripe

Flutter SDK for Stripe.
https://pub.dev/packages/flutter_stripe
945 stars 522 forks source link

E/MethodChannel#flutter.stripe/payments: Failed to handle method call android.content.ActivityNotFoundException: Unable to find explicit activity class {com.tempmail.mjtechnologies/com.stripe.android.paymentsheet.PaymentSheetActivity}; have you declared this activity in your AndroidManifest.xml? #1050

Closed karamatpkid closed 1 year ago

karamatpkid commented 1 year ago

we getting this issue in E/MethodChannel#flutter.stripe/payments: Failed to handle method call android.content.ActivityNotFoundException: Unable to find explicit activity class {com.jjjjjjj.jjjkkkkjjjkk/com.stripe.android.paymentsheet.PaymentSheetActivity}; have you declared this activity in your AndroidManifest.xml?

Manifest <activity android:name=".MainActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

        android:hardwareAccelerated="true"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:windowSoftInputMode="adjustResize"
        android:exported="true"
        tools:node="merge">

        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW"/>

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="flutterstripe" android:host="safepay" />
        </intent-filter>
    </activity>

these are below flutter Packages which have been used

name: tempmail description: A new Flutter project.

The following line prevents the package from being accidentally published to

pub.dev using flutter pub publish. This is preferred for private packages.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

The following defines the version and build number for your application.

A version number is three numbers separated by dots, like 1.2.43

followed by an optional build number separated by a +.

Both the version and the builder number may be overridden in flutter

build by specifying --build-name and --build-number, respectively.

In Android, build-name is used as versionName while build-number used as versionCode.

Read more about Android versioning at https://developer.android.com/studio/publish/versioning

In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.

Read more about iOS versioning at

https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

In Windows, build-name is used as the major, minor, and patch parts

of the product and file versions while build-number is used as the build suffix.

version: 1.0.0+2

environment: sdk: '>=2.19.0-255.2.beta <3.0.0'

Dependencies specify other packages that your package needs in order to work.

To automatically upgrade your package dependencies to the latest versions

consider running flutter pub upgrade --major-versions. Alternatively,

dependencies can be manually updated by changing the version numbers below to

the latest version available on pub.dev. To see which dependencies have newer

versions available, run flutter pub outdated.

dependencies: flutter: sdk: flutter

The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.2

dev_dependencies: flutter_test: sdk: flutter

The "flutter_lints" package below contains a set of recommended lints to

encourage good coding practices. The lint set provided by the package is

activated in the analysis_options.yaml file located at the root of your

package. See that file for information about deactivating specific lint

rules and activating additional ones.

cupertino_icons: ^1.0.2 flutter_lints: ^2.0.0 flutter_html: ^2.2.1 provider: ^6.0.3 nb_utils: ^4.6.20 sizer: ^2.0.15 http: ^0.13.5 dotted_border: any lottie: ^1.4.3 dropdown_button2: ^1.8.2 horizontal_data_table: ^4.1.2+2 clipboard: ^0.1.3 fluttertoast: ^8.0.9 flutter_braintree: any flutter_credit_card: ^3.0.4 qr_flutter: ^4.0.0 flutter_launcher_icons: ^0.10.0 intl: ^0.17.0 flutter_zoom_drawer: ^3.0.0 url_launcher: ^6.1.6 cloud_firestore: ^4.0.3 firebase_core: ^2.1.1 google_mobile_ads: ^1.2.0 flutter_automation: ^2.0.0 change_app_package_name: ^1.1.0 flutter_paypal: ^0.0.8 flutter_stripe: ^7.0.0

For information on the generic Dart part of this file, see the

following page: https://dart.dev/tools/pub/pubspec

The following section is specific to Flutter packages.

flutter:

The following line ensures that the Material Icons font is

included with your application, so that you can use the icons in

the material Icons class.

uses-material-design: true

To add assets to your application, add an assets section, like this:

assets:

there are below style values For Day

<?xml version="1.0" encoding="utf-8"?>

Night Values

<?xml version="1.0" encoding="utf-8"?>

Complete Error

E/MethodChannel#flutter.stripe/payments: Failed to handle method call android.content.ActivityNotFoundException: Unable to find explicit activity class {com.****.m*escom.stripe.android.paymentsheet.PaymentSheetActivity}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2098) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1747) at android.app.Activity.startActivityForResult(Activity.java:5473) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:728) at androidx.core.app.ActivityCompat$Api16Impl.startActivityForResult(ActivityCompat.java:809) at androidx.core.app.ActivityCompat.startActivityForResult(ActivityCompat.java:246) at androidx.activity.ComponentActivity$2.onLaunch(ComponentActivity.java:243) at androidx.activity.result.ActivityResultRegistry$2.launch(ActivityResultRegistry.java:175) at androidx.fragment.app.Fragment$10.launch(Fragment.java:3612) at androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.java:47) at com.stripe.android.paymentsheet.DefaultPaymentSheetLauncher.present(DefaultPaymentSheetLauncher.kt:102) at com.stripe.android.paymentsheet.DefaultPaymentSheetLauncher.presentWithPaymentIntent(DefaultPaymentSheetLauncher.kt:82) at com.stripe.android.paymentsheet.PaymentSheet.presentWithPaymentIntent(PaymentSheet.kt:67) at com.reactnativestripesdk.PaymentSheetFragment.present(PaymentSheetFragment.kt:147) at com.reactnativestripesdk.StripeSdkModule.presentPaymentSheet(StripeSdkModule.kt:158) at com.flutter.stripe.StripeAndroidPlugin.onMethodCall(StripeAndroidPlugin.kt:126) at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258) at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295) at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322) at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) I/ViewRootImpl@e418ebc[MainActivity]: stopped(false) old=false I/flutter: Error is:--->PlatformException(error, Unable to find explicit activity class {com.****.m*es/com.stripe.android.paymentsheet.PaymentSheetActivity}; have you declared this activity in your AndroidManifest.xml?, null, android.content.ActivityNotFoundException: Unable to find explicit activity class {com.****.m***es/com.stripe.android.paymentsheet.PaymentSheetActivity}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2098) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1747) at android.app.Activity.startActivityForResult(Activity.java:5473) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:728) at androidx.core.app.ActivityCompat$Api16Impl.startActivityForResult(ActivityCompat.java:809) at androidx.core.app.ActivityCompat.startActivityForResult(ActivityCompat.java:246) at androidx.activity.ComponentActivity$2.onLaunch(ComponentActivit

remonh87 commented 1 year ago

I would recommend following the steps described: https://docs.page/flutter-stripe/flutter_stripe/troubleshooting

and also check https://github.com/flutter-stripe/flutter_stripe/discussions/538

It looks like your MainActivity doesn't extend FlutterFragmentActivity

karamatpkid commented 1 year ago

still i have same issue , i followed exactly same configuration as mentioned

karamatpkid commented 1 year ago

i am facing this kind of issue E/MethodChannel#flutter.stripe/payments(24528): Failed to handle method call E/MethodChannel#flutter.stripe/payments(24528): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.tempmail.mjtechnologies/com.stripe.android.paymentsheet.PaymentSheetActivity}; have you declared this activity in your AndroidManifest.xml?

karamatpkid commented 1 year ago

i have solved this, actually i were using braintree payment method, i have removed braintree. now flutter_strip working fine