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

CardField crash on Flutter(android) #1597

Closed
punitsamcom84 opened this issue Jan 17, 2024 · 11 comments
Closed

CardField crash on Flutter(android) #1597

punitsamcom84 opened this issue Jan 17, 2024 · 11 comments
Labels
Awaiting response Awaiting response from the issuer

Comments

@punitsamcom84
Copy link

i used flutter_stripe: ^10.0.0

this is code:

class paymentCard extends StatefulWidget{
@OverRide
State createState() => _paymentCardState();
}

class _paymentCardState extends State {

@OverRide
Widget build(BuildContext context) {
return CardField(
onCardChanged: (card) {

  },
);

}
}

this is error:
E/flutter ( 7153): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
E/flutter ( 7153): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:322:18)
E/flutter ( 7153):
E/flutter ( 7153): #2 ExpensiveAndroidViewController._sendCreateMessage (package:flutter/src/services/platform_views.dart:1081:5)
E/flutter ( 7153):
E/flutter ( 7153): #3 AndroidViewController.create (package:flutter/src/services/platform_views.dart:804:5)
E/flutter ( 7153):

@punitsamcom84 punitsamcom84 added the needs triage Needs triage label Jan 17, 2024
@Anonymousgaurav
Copy link

got the same issue. did you find solution ? @punitsamcom84

@remonh87
Copy link
Member

did you add WidgetsFlutterBinding.ensureInitialized(); to the main of your application? also give me a bit more context so I can look further into it:

  • output of flutter doctor
  • Android version and device

I do not think there is much I can do about it as it looks like an issue in flutter itself

@remonh87 remonh87 added Awaiting response Awaiting response from the issuer and removed needs triage Needs triage labels Jan 22, 2024
@punitsamcom84
Copy link
Author

punitsamcom84 commented Jan 23, 2024

@remonh87 yes i already add this ### WidgetsFlutterBinding.ensureInitialized();

main.dart :

import 'package:flutter/material.dart';
import 'package:flutter_stripe_demo/payment_card.dart';

void main() async{
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MyHomePage(),
);
}
}

class MyHomePage extends StatelessWidget{
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body:paymentCard()
);
}

}

payment_card.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter_stripe/flutter_stripe.dart';

class paymentCard extends StatefulWidget{
@OverRide
State createState() => _paymentCardState();
}

class _paymentCardState extends State {

@OverRide
void initState() {
super.initState();
}

@OverRide
Widget build(BuildContext context) {
return CardField(
controller: CardEditController(),
onCardChanged: (card) {

  },
);

}
}

android version : 12
device model : sdk_gphone64_x86_64(emulator)

flutte doctor screen

@Anonymousgaurav
Copy link

@punitsamcom84 try on real device..

@Anonymousgaurav
Copy link

@remonh87 my issue fixed!! it was due to wrong navigation

@remonh87
Copy link
Member

@punitsamcom84 make sure to also add the stripe intialisation as I cannot see this in your code sample. See

Stripe.publishableKey = stripePublishableKey;

@SushanDristi
Copy link

@remonh87 my issue fixed!! it was due to wrong navigation

I am also having issue when i navigate to next screen from card screen. Can you explain me how you fix it?

@punitsamcom84
Copy link
Author

@Anonymousgaurav I am testing on a real device but didn't work for me.

@mian-asif
Copy link

mian-asif commented Jan 26, 2024

The error indicates a crash in your Flutter application on Android, specifically related to handling text input.
This error suggests that there is a method call to getEmojiStart on EmojiCompat that does not exist.
dependencies {

implementation "androidx.emoji2:emoji2:1.4.0"
implementation "androidx.emoji2:emoji2-views:1.4.0"
implementation "androidx.emoji2:emoji2-views-helper:1.4.0"

}
Add these lines in the App Level Build.Gradle in dependencies

@ripal-crescentek
Copy link

ripal-crescentek commented Feb 20, 2024

Try to add

<provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    android:exported="false"
    tools:node="merge">
    <meta-data android:name="androidx.emoji2.text.EmojiCompatInitializer"
        tools:node="remove" />
</provider>

inside android folder in manifest.xml file under <application> without adding below dependencies in app level Build.Gradle

implementation "androidx.emoji2:emoji2:1.4.0"
implementation "androidx.emoji2:emoji2-views:1.4.0"
implementation "androidx.emoji2:emoji2-views-helper:1.4.0"

@remonh87 remonh87 closed this as completed Mar 2, 2024
@Manali-Flynaut
Copy link

@remonh87 my issue fixed!! it was due to wrong navigation

@remonh87 my issue fixed!! it was due to wrong navigation

@Anonymousgaurav how did you solved this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting response Awaiting response from the issuer
Projects
None yet
Development

No branches or pull requests

7 participants