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

[Android] IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant) #98

Closed
mike392 opened this issue May 31, 2021 · 1 comment

Comments

@mike392
Copy link

mike392 commented May 31, 2021

Hi, Team,

I have the following problem with the card field.
I have done this:
Stripe.publishableKey = Constants.getPublishableKey();
And this is my pay button callback:
void onPressPayCallback() async { await Stripe.instance.createPaymentMethod(PaymentMethodParams.card()); }
And in order to make it work i have to put a CardFIeld widget:
Widget? _buildBodyContent(BuildContext context) { return Column( children: [ CardField( onFocus: (name) {}, numberHintText: "Number", expirationHintText: "Expiry", cvcHintText: "CVC", postalCodeHintText: "Postal Code", onCardChanged: (card) { print(card); }, ), Divider(height: 1), ]); }

However, when i press the button with the callback i have the error above.
Please, advise me on that error :)

My flutter doctor -v

[✓] Flutter (Channel stable, 2.0.1, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-ES)
    • Flutter version 2.0.1 at 
    • Framework revision c5a4b4029c (3 months ago), 2021-03-04 09:47:48 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 55.1.5
    • Dart plugin version 211.6693.108

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • sdk gphone x86 arm (mobile) • emulator-5554                        • android-x86    • Android 11 (API 30) (emulator)
    • iPhone 8 (mobile)           • B3CBF822-CFE4-45CB-9EA3-D732CCC55566 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-1 (simulator)
    • macOS (desktop)             • macos                                • darwin-x64     • Mac OS X 10.15.7 19H15 darwin-x64
    • Chrome (web)                • chrome                               • web-javascript • Google Chrome 90.0.4430.212

• No issues found!

The complete stacktrace is the following:

E/MethodChannel#flutter/platform_views( 5346): Failed to handle method call
E/MethodChannel#flutter/platform_views( 5346): android.view.InflateException: Binary XML file line #22 in com.eatandparty:layout/card_input_widget: Binary XML file line #22 in com.eatandparty:layout/card_input_widget: Error inflating class com.google.android.material.textfield.TextInputLayout
E/MethodChannel#flutter/platform_views( 5346): Caused by: android.view.InflateException: Binary XML file line #22 in com.eatandparty:layout/card_input_widget: Error inflating class com.google.android.material.textfield.TextInputLayout
E/MethodChannel#flutter/platform_views( 5346): Caused by: java.lang.reflect.InvocationTargetException
E/MethodChannel#flutter/platform_views( 5346): 	at java.lang.reflect.Constructor.newInstance0(Native Method)
E/MethodChannel#flutter/platform_views( 5346): 	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.createView(LayoutInflater.java:852)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:654)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
E/MethodChannel#flutter/platform_views( 5346): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
E/MethodChannel#flutter/platform_views( 5346): 	at com.stripe.android.databinding.CardInputWidgetBinding.inflate(CardInputWidgetBinding.java:88)
E/MethodChannel#flutter/platform_views( 5346): 	at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
E/MethodChannel#flutter/platform_views( 5346): 	at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
E/MethodChannel#flutter/platform_views( 5346): 	at com.reactnativestripesdk.StripeSdkCardView.<init>(StripeSdkCardView.kt:27)
E/MethodChannel#flutter/platform_views( 5346): 	at com.reactnativestripesdk.StripeSdkCardViewManager.createViewInstance(StripeSdkCardViewManager.kt:47)
E/MethodChannel#flutter/platform_views( 5346): 	at com.flutter.stripe.StripeSdkCardPlatformView.<init>(StripeSdkCardPlatformView.kt:30)
E/MethodChannel#flutter/platform_views( 5346): 	at com.flutter.stripe.StripeSdkCardPlatformViewFactory.create(StripeSdkCardPlatformViewFactory.kt:19)
E/MethodChannel#flutter/platform_views( 5346): 	at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:146)
E/MethodChannel#flutter/platform_views( 5346): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:101)
E/MethodChannel#flutter/platform_views( 5346): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/MethodChannel#flutter/platform_views( 5346): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter/platform_views( 5346): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter/platform_views( 5346): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#flutter/platform_views( 5346): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter/platform_views( 5346): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#flutter/platform_views( 5346): 	at android.os.Looper.loop(Looper.java:183)
E/MethodChannel#flutter/platform_views( 5346): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#flutter/platform_views( 5346): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/platform_views( 5346): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#flutter/platform_views( 5346): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/MethodChannel#flutter/platform_views( 5346): Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
E/MethodChannel#flutter/platform_views( 5346): 	at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:243)
E/MethodChannel#flutter/platform_views( 5346): 	at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:213)
E/MethodChannel#flutter/platform_views( 5346): 	at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:148)
E/MethodChannel#flutter/platform_views( 5346): 	at com.google.android.material.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:115)
E/MethodChannel#flutter/platform_views( 5346): 	at com.google.android.material.textfield.TextInputLayout.<init>(TextInputLayout.java:463)
E/MethodChannel#flutter/platform_views( 5346): 	at com.google.android.material.textfield.TextInputLayout.<init>(TextInputLayout.java:422)
E/MethodChannel#flutter/platform_views( 5346): 	... 31 more
E/flutter ( 5346): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(error, Binary XML file line #22 in com.eatandparty:layout/card_input_widget: Binary XML file line #22 in com.eatandparty:layout/card_input_widget: Error inflating class com.google.android.material.textfield.TextInputLayout, null, android.view.InflateException: Binary XML file line #22 in com.eatandparty:layout/card_input_widget: Binary XML file line #22 in com.eatandparty:layout/card_input_widget: Error inflating class com.google.android.material.textfield.TextInputLayout
E/flutter ( 5346): Caused by: android.view.InflateException: Binary XML file line #22 in com.eatandparty:layout/card_input_widget: Error inflating class com.google.android.material.textfield.TextInputLayout
E/flutter ( 5346): Caused by: java.lang.reflect.InvocationTargetException
E/flutter ( 5346): 	at java.lang.reflect.Constructor.newInstance0(Native Method)
E/flutter ( 5346): 	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
E/flutter ( 5346): 	at android.view.LayoutInflater.createView(LayoutInflater.java:852)
E/flutter ( 5346): 	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
E/flutter ( 5346): 	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
E/flutter ( 5346): 	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
E/flutter ( 5346): 	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
E/flutter ( 5346): 	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
E/flutter ( 5346): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:654)
E/flutter ( 5346): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
E/flutter ( 5346): 	at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
E/flutter ( 5346): 	at com.stripe.android.databinding.CardInputWidgetBinding.inflate(CardInputWidgetBinding.java:88)
E/flutter ( 5346): 	at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
E/flutter ( 5346): 	at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
E/flutter ( 5346): 	at com.reactnativestripesdk.StripeSdkCardView.<init>(StripeSdkCardView.kt:27)
E/flutter ( 5346): 	at com.reactnativestripesdk.StripeSdkCardViewManager.createViewInstance(StripeSdkCardViewManager.kt:47)
E/flutter ( 5346): 	at com.flutter.stripe.StripeSdkCardPlatformView.<init>(StripeSdkCardPlatformView.kt:30)
E/flutter ( 5346): 	at com.flutter.stripe.StripeSdkCardPlatformViewFactory.create(StripeSdkCardPlatformViewFactory.kt:19)
E/flutter ( 5346): 	at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:146)
E/flutter ( 5346): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:101)
E/flutter ( 5346): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/flutter ( 5346): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter ( 5346): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter ( 5346): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/flutter ( 5346): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 5346): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter ( 5346): 	at android.os.Looper.loop(Looper.java:183)
E/flutter ( 5346): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter ( 5346): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 5346): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter ( 5346): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 5346): Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
E/flutter ( 5346): 	at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:243)
E/flutter ( 5346): 	at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:213)
E/flutter ( 5346): 	at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:148)
E/flutter ( 5346): 	at com.google.android.material.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:115)
E/flutter ( 5346): 	at com.google.android.material.textfield.TextInputLayout.<init>(TextInputLayout.java:463)
E/flutter ( 5346): 	at com.google.android.material.textfield.TextInputLayout.<init>(TextInputLayout.java:422)
E/flutter ( 5346): 	... 31 more
E/flutter ( 5346): )
E/flutter ( 5346): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581:7)
E/flutter ( 5346): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
E/flutter ( 5346): <asynchronous suspension>
E/flutter ( 5346): #2      AndroidViewController.create (package:flutter/src/services/platform_views.dart:742:5)
E/flutter ( 5346): <asynchronous suspension>
E/flutter ( 5346): 
E/flutter ( 5346): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method requestFocus on channel flutter.stripe/card_field/0)
E/flutter ( 5346): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)
E/flutter ( 5346): <asynchronous suspension>
E/flutter ( 5346): 
E/flutter ( 5346): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method onPlaceholderChanged on channel flutter.stripe/card_field/0)
E/flutter ( 5346): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)
E/flutter ( 5346): <asynchronous suspension>
E/flutter ( 5346): 
@jonasbark
Copy link
Member

Please read the Readme - dupe of #69

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

2 participants