Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception:PlatformException(flutter_stripe initialization failed, The plugin failed to initialize: #670

Closed
Zasaz opened this issue Apr 8, 2022 · 1 comment
Labels
needs triage Needs triage

Comments

@Zasaz
Copy link

Zasaz commented Apr 8, 2022

Hello, i am facing this issue and i have done everything according to the documentation provided by the "flutter_stripe" on github.

//************************************************
This is the issue that i face:

I/flutter ( 4010): exception:PlatformException(flutter_stripe initialization failed, The plugin failed to initialize:
I/flutter ( 4010): Your Main Activity class com.app.chasescroll_flutter.MainActivity is not a subclass FlutterFragmentActivity.
I/flutter ( 4010): Please make sure you follow all the steps detailed inside the README: https://github.com/flutter-stripe/flutter_stripe#android
I/flutter ( 4010): If you continue to have trouble, follow this discussion to get some support #538, null, null)#0 JSONMet
hodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:155:7)
I/flutter ( 4010): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
I/flutter ( 4010):
I/flutter ( 4010): #2 MethodChannelStripe.initialise (package:stripe_platform_interface/src/method_channel_stripe.dart:43:5)
I/flutter ( 4010):
I/flutter ( 4010): #3 Stripe._initialise (package:flutter_stripe/src/stripe.dart:415:5)
I/flutter ( 4010):
I/flutter ( 4010): #4 Stripe.initPaymentSheet (package:flutter_stripe/src/stripe.dart:318:5)
I/flutter ( 4010): <

//************************************************

This is my Manifest file:

//************************************************
//************************************************














<application
    tools:replace="android:label"
    android:usesCleartextTraffic="true"
    android:label="chasescroll_flutter"
    android:icon="@mipmap/ic_launcher"
    >
    <!-- android:usesCleartextTraffic="true"    (application^)-->

    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
    <meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>

    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
        <intent-filter>
            <action android:name="FLUTTER_NOTIFICATION_CLICK" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <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:host="chasescroll.page/link" android:scheme="http"/>
            <data android:host="chasescroll.page/link" android:scheme="https"/>
        </intent-filter>
    </activity>
    <activity android:name="com.facebook.FacebookActivity"
        android:configChanges=
            "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name" />
    <activity
        android:name="com.facebook.CustomTabActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/fb_login_protocol_scheme" />
        </intent-filter>
    </activity>
    <!-- Set up the Sign in with Apple activity, such that it's callable from the browser-redirect -->
    <activity
        android:name="com.aboutyou.dart_packages.sign_in_with_apple.SignInWithAppleCallback"
        android:exported="true"
        >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="signinwithapple" />
            <data android:path="callback" />
        </intent-filter>
    </activity>
    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.fileProvider"
        android:exported="false"
        android:grantUriPermissions="true"
        tools:replace="android:authorities">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/filepaths"
            tools:replace="android:resource" />
    </provider>
    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2"
        />
    <!-- <meta-data
        android:name="io.flutter.network-policy"
        android:resource="@xml/network_security_config"
        /> -->
</application>

//************************************************
//************************************************

This is my MainActivity.kt file:

package com.app.chasescroll_flutter

import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity: FlutterFragmentActivity() {
}

//************************************************
//************************************************

I have also changed my build.gradle/app and changed the kotlin version to 1.5.10 and upgraded my minSdkVersion to 21. I am astuck on this issue from 3 days and couldn't find any helping material from github/issues. Kindly guide me if there's any way to solve this. Thanks

@Zasaz Zasaz added the needs triage Needs triage label Apr 8, 2022
@jonasbark
Copy link
Member

Please continue here: #538

It's possible that the android:name=".MainActivity" part does not point to the correct class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Needs triage
Projects
None yet
Development

No branches or pull requests

2 participants