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

await Stripe.instance.dangerouslyUpdateCardDetails(_card); give an error on android. In Ios working fine #288

Closed
MalikTuseef opened this issue Aug 16, 2021 · 4 comments

Comments

@MalikTuseef
Copy link

2021-08-16 20:44:16.649 21407-21407/com.example.bringfood E/MethodChannel#flutter.stripe/payments: Failed to handle method call
android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class com.google.android.material.textfield.TextInputLayout
Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class com.google.android.material.textfield.TextInputLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:651)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:870)
at android.view.LayoutInflater.inflate(LayoutInflater.java:493)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.stripe.android.databinding.CardInputWidgetBinding.inflate(CardInputWidgetBinding.java:88)
at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:63)
at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:60)
at com.reactnativestripesdk.StripeSdkCardView.(StripeSdkCardView.kt:33)
at com.reactnativestripesdk.StripeSdkCardViewManager.createViewInstance(StripeSdkCardViewManager.kt:67)
at com.reactnativestripesdk.StripeSdkCardViewManager.setCardDetails(StripeSdkCardViewManager.kt:90)
at com.flutter.stripe.StripeAndroidPlugin.onMethodCall(StripeAndroidPlugin.kt:104)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:331)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:243)
at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:213)
at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:148)
at com.google.android.material.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:115)
at com.google.android.material.textfield.TextInputLayout.(TextInputLayout.java:463)
at com.google.android.material.textfield.TextInputLayout.(TextInputLayout.java:422)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 
at android.view.LayoutInflater.createView(LayoutInflater.java:651) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:867) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:870) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:493) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at com.stripe.android.databinding.CardInputWidgetBinding.inflate(CardInputWidgetBinding.java:88) 
at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:63) 
at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:60) 
at com.reactnativestripesdk.StripeSdkCardView.(StripeSdkCardView.kt:33) 
at com.reactnativestripesdk.StripeSdkCardViewManager.createViewInstance(StripeSdkCardViewManager.kt:67) 
at com.reactnativestripesdk.StripeSdkCardViewManager.setCardDetails(StripeSdkCardViewManager.kt:90) 
at com.flutter.stripe.StripeAndroidPlugin.onMethodCall(StripeAndroidPlugin.kt:104) 
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) 
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) 
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818) 
at android.os.MessageQueue.nativePollOnce(Native Method) 
at android.os.MessageQueue.next(MessageQueue.java:331) 
at android.os.Looper.loop(Looper.java:149) 
at android.app.ActivityThread.main(ActivityThread.java:6651) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824) 
2021-08-16 20:44:16.699 21407-21507/com.example.bringfood E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(error, Binary XML file line #22: Binary XML file line #22: Error inflating class com.google.android.material.textfield.TextInputLayout, null, android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class com.google.android.material.textfield.TextInputLayout
Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class com.google.android.material.textfield.TextInputLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:651)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:870)
at android.view.LayoutInflater.inflate(LayoutInflater.java:493)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.stripe.android.databinding.CardInputWidgetBinding.inflate(CardInputWidgetBinding.java:88)
at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:63)
at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:60)
at com.reactnativestripesdk.StripeSdkCardView.(StripeSdkCardView.kt:33)
at com.reactnativestripesdk.StripeSdkCardViewManager.createViewInstance(StripeSdkCardViewManager.kt:67)
at com.reactnativestripesdk.StripeSdkCardViewManager.setCardDetails(StripeSdkCardViewManager.kt:90)
at com.flutter.stripe.StripeAndroidPlugin.onMethodCall(StripeAndroidPlugin.kt:104)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:331)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:243)
at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:213)
at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:148)
at com.google.android.material.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:115)
at com.google.android.material.textfield.TextInputLayout.(TextInputLayout.java:463)
at com.google.android.material.textfield.TextInputLayout.(TextInputLayout.java:422)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 
at android.view.LayoutInflater.createView(LayoutInflater.java:651) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:867) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:870) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:493) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at com.stripe.android.databinding.CardInputWidgetBinding.inflate(CardInputWidgetBinding.java:88) 
at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:63) 
at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:60) 
at com.reactnativestripesdk.StripeSdkCardView.(StripeSdkCardView.kt:33) 
at com.reactnativestripesdk.StripeSdkCardViewManager.createViewInstance(StripeSdkCardViewManager.kt:67) 
at com.reactnativestripesdk.StripeSdkCardViewManager.setCardDetails(StripeSdkCardViewManager.kt:90) 
at com.flutter.stripe.StripeAndroidPlugin.onMethodCall(StripeAndroidPlugin.kt:104) 
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) 
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) 
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818) 
at android.os.MessageQueue.nativePollOnce(Native Method) 
at android.os.MessageQueue.next(MessageQueue.java:331) 
at android.os.Looper.loop(Looper.java:149) 
at android.app.ActivityThread.main(ActivityThread.java:6651) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824) 
)
#0 JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:164:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)

#2 MethodChannelStripe.dangerouslyUpdateCardDetails (package:stripe_platform_interface/src/method_channel_stripe.dart:212:5)

#3 Stripe.dangerouslyUpdateCardDetails (package:flutter_stripe/src/stripe.dart:326:12)

#4 AddCreditCardState._handlePayPress (package:bring_food/presentation/screens/add_credit_card.dart:139:5)

#5 _Loadin

@jonasbark
Copy link
Member

Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).

please follow the requirements for Android closely:
https://github.com/flutter-stripe/flutter_stripe#android

@MalikTuseef
Copy link
Author

WidgetsFlutterBinding.ensureInitialized();
is it necessary? whta's the purpose of this line

@MalikTuseef
Copy link
Author

i double check all things but issue was same

@marcolettieri
Copy link
Contributor

@MalikTuseef remember to change also the night style

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

No branches or pull requests

3 participants