-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
Key buttonType expected Integer but value was a java.lang.String. The default value 0 was returned. java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer #1887
Comments
It still looks like somewhere there is a theme injected. For us to debug this can you provide a minimum reproducible example? |
Hi Remonh87! I appreciate the response. These are my sheet parameters: await Stripe.instance.initPaymentSheet(
), I am saving the customer info and retrieving the client info from the backend successfully. Other than this, there is really not much else to change here other than color changes. After taking a deeper look into this, I have come to realize that if I were to cross out the Google Pay button in the sheet, that there are no longer any theming issues and this java.lang.ClassCastException does not appear. After looking at similar type issues, this issue does not involve the Apple Pay button, but only the Google Pay button. I also have the same problem in that the Google Pay button when using the (stripe version) is not directly clickable. Also, after I upgraded to Flutter 3.24, I have also observed that the Google Pay button within the sheet no longer appears to function properly. I press the Google Pay button, and even though the payment has processed successfully, the button itself shows Error. This did not happen in Flutter 3.19 version prior to upgrade. Is it possible that I can get some confirmation about if the Google Pay button if this in anyway is still bugged or not? For the time being, I have removed anything in regard to Google Pay until this is fixed. Thank you. Similar issues: |
@jonasbark looks like this is related to #1861 can you take a look at it? It looks like theming cannot be found. I can reproduce it. |
I just received this notification: We recommend you update to SDK version 20.48.5 or later to avoid future issues. We’re sorry for the trouble this issue has caused. Please let us know if you have any additional questions about the issue by replying to this email. — The Stripe team This should hopefully address the Google Pay button inside of the sheet, but I think the theming issue still exists. |
@remonh87 how have you been able to reproduce this? I'm using Flutter 3.24.0 and was able to use the example apps payment sheet with Google Pay without an issue |
did you use latest main branch? I just try it again and issue still happens. I am able to pay with google pay using the stripe elements |
I cannot reproduce this anymore and for me the issue works using the latest version of stripe. Feel free to reopen if the issue still persist |
Ok, thank you for the help. I will try the latest version and let you know if any issues arise. |
Flutter 3.24
• Framework revision 80c2e84975 (9 days ago), 2024-07-30 23:06:49 +0700
• Engine revision b8800d88be
• Dart version 3.5.0
• DevTools version 2.37.2
Testing on a Samsung S21 Ultra on Android 14.0. No problems with Flutter doctor.
Latest Flutter Stripe version 11.0.0
These are the primary errors that I am facing:
This happens in both Light and Dark modes.
W/Bundle (10777): Key buttonType expected Integer but value was a java.lang.String. The default value 0 was returned.
W/Bundle (10777): Attempt to cast generated internal exception:
W/Bundle (10777): java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
D/PluginDetector(10777): com.facebook.react.bridge.NativeModule not found: java.lang.ClassNotFoundException: com.facebook.react.bridge.NativeModule
D/CompatibilityChangeReporter(10777): Compat change id reported: 210923482; UID 11062; state: ENABLED
E/ThemeUtils(10777): View class android.support.v7.widget.AppCompatTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/ThemeUtils(10777): View class com.google.android.material.imageview.ShapeableImageView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
W/ResourcesCompat(10777): Failed to inflate ColorStateList, leaving it to the framework
W/ResourcesCompat(10777): java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7c040084 a=-1}, theme={InheritanceMap=[id=0x7c1100a8com.google.android.gms:style/PayButtonDarkTheme], Themes=[com.google.android.gms:style/PayButtonDarkTheme, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
I am loading the regular Payment Sheet. The sheet is fully functional on my Android device, as in the Google Pay button is not locked and I can process payment from it. The payment sheet is also fully functional on iOS.
I do not have any other Flutter plugins that required the use of styles.xml. Previously, I had used Flutter Native Splash though from what I have read online, it seems that it also used the Themes and may have created a problem.
This is what I attempted:
Removed the edited styles from Flutter Native Splash and copied and pasted the Flutter-Stripe example style.xmls
Removed Flutter Native Splash/Flutter clean build, and the errors still persisted.
Removed the values-night-v31and values-v31 created by Flutter Native Splash and the same errors still existed.
dependencies {
implementation "com.google.android.material:material:1.12.0"
}
As per recommendations in the Discussion section, I had added this, but it didn't change anything.
These are the themes used for the styles.xml files:
<style name="LaunchTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> @drawable/launch_background </style> <style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar"> @drawable/launch_background </style>The text was updated successfully, but these errors were encountered: