You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When attempting to use CardFormField, I am running into an exception even if I copy all the same manifest, build.gradle, style.xml, etc. as the example has. The exception says "The style on this component requires your app theme to be Theme.MaterialComponents" when I already have it set in my styles.xml file, and in AndroidManifest.xml.
Styles:
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="Theme.MaterialComponents">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
AndroidManifest:
<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">
<!-- 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"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
<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>
The exception is:
2021-11-30 21:51:41.479 5479-5479/com.rvdoctor E/MethodChannel#flutter/platform_views: Failed to handle method call
android.view.InflateException: Binary XML file line #5 in com.rvdoctor:layout/stripe_card_form_view: Binary XML file line #5 in com.rvdoctor:layout/stripe_card_form_view: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #5 in com.rvdoctor:layout/stripe_card_form_view: Error inflating class
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.inflate(LayoutInflater.java:654)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at com.stripe.android.databinding.StripeCardFormViewBinding.inflate(StripeCardFormViewBinding.java:74)
at com.stripe.android.view.CardFormView.(CardFormView.kt:46)
at com.reactnativestripesdk.CardFormView.(CardFormView.kt:22)
at com.reactnativestripesdk.CardFormViewManager.createViewInstance(CardFormViewManager.kt:56)
at com.flutter.stripe.StripeSdkCardFormPlatformView.(StripeSdkCardFormPlatformView.kt:33)
at com.flutter.stripe.StripeSdkCardFormPlatformViewFactory.create(StripeSdkCardFormPlatformViewFactory.kt:22)
at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:151)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:243)
at com.google.android.material.internal.ThemeEnforcement.checkMaterialTheme(ThemeEnforcement.java:217)
at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:145)
at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:76)
at com.google.android.material.card.MaterialCardView.(MaterialCardView.java:124)
at com.google.android.material.card.MaterialCardView.(MaterialCardView.java:114)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.inflate(LayoutInflater.java:654)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at com.stripe.android.databinding.StripeCardFormViewBinding.inflate(StripeCardFormViewBinding.java:74)
at com.stripe.android.view.CardFormView.(CardFormView.kt:46)
at com.reactnativestripesdk.CardFormView.(CardFormView.kt:22)
at com.reactnativestripesdk.CardFormViewManager.createViewInstance(CardFormViewManager.kt:56)
at com.flutter.stripe.StripeSdkCardFormPlatformView.(StripeSdkCardFormPlatformView.kt:33)
at com.flutter.stripe.StripeSdkCardFormPlatformViewFactory.create(StripeSdkCardFormPlatformViewFactory.kt:22)
at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:151)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
2021-11-30 21:51:41.581 5479-5529/com.rvdoctor E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, Binary XML file line #5 in com.rvdoctor:layout/stripe_card_form_view: Binary XML file line #5 in com.rvdoctor:layout/stripe_card_form_view: Error inflating class , null, android.view.InflateException: Binary XML file line #5 in com.rvdoctor:layout/stripe_card_form_view: Binary XML file line #5 in com.rvdoctor:layout/stripe_card_form_view: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #5 in com.rvdoctor:layout/stripe_card_form_view: Error inflating class
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.inflate(LayoutInflater.java:654)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at com.stripe.android.databinding.StripeCardFormViewBinding.inflate(StripeCardFormViewBinding.java:74)
at com.stripe.android.view.CardFormView.(CardFormView.kt:46)
at com.reactnativestripesdk.CardFormView.(CardFormView.kt:22)
at com.reactnativestripesdk.CardFormViewManager.createViewInstance(CardFormViewManager.kt:56)
at com.flutter.stripe.StripeSdkCardFormPlatformView.(StripeSdkCardFormPlatformView.kt:33)
at com.flutter.stripe.StripeSdkCardFormPlatformViewFactory.create(StripeSdkCardFormPlatformViewFactory.kt:22)
at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:151)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:243)
at com.google.android.material.internal.ThemeEnforcement.checkMaterialTheme(ThemeEnforcement.java:217)
at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:145)
at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:76)
at com.google.android.material.card.MaterialCardView.(MaterialCardView.java:124)
at com.google.android.material.card.MaterialCardView.(MaterialCardView.java:114)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.inflate(LayoutInflater.java:654)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at com.stripe.android.databinding.StripeCardFormViewBinding.inflate(StripeCardFormViewBinding.java:74)
at com.stripe.android.view.CardFormView.(CardFormView.kt:46)
at com.reactnativestripesdk.CardFormView.(CardFormView.kt:22)
at com.reactnativestripesdk.CardFormViewManager.createViewInstance(CardFormViewManager.kt:56)
at com.flutter.stripe.StripeSdkCardFormPlatformView.(StripeSdkCardFormPlatformView.kt:33)
at com.flutter.stripe.StripeSdkCardFormPlatformViewFactory.create(StripeSdkCardFormPlatformViewFactory.kt:22)
at io.flutter.plugin.platform.PlatformViewsController$1.createAndroidViewForPlatformView(PlatformViewsController.java:151)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loop(Looper.java:183)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7) #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
Please check again if you have correctly changed the styles as they are required both in values/styles.xml, values-night/styles.xml(if exits), and the manifest.
The error explicitly says is because of this:
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
Describe the bug
When attempting to use CardFormField, I am running into an exception even if I copy all the same manifest, build.gradle, style.xml, etc. as the example has. The exception says "The style on this component requires your app theme to be Theme.MaterialComponents" when I already have it set in my styles.xml file, and in AndroidManifest.xml.
Styles:
AndroidManifest:
The exception is:
To Reproduce
Steps to reproduce the behavior:
Anytime I try to add CardFormField widget to build method.
Expected behavior
I expect CardFormField to be displayed on the screen, but nothing is displayed and the exception is thrown.
Smartphone / tablet
The text was updated successfully, but these errors were encountered: