Description
Hello,
As the title suggests, this Stripe library does not work on any of my Android phones (for example, the Pixel 6 with Android 14).
Detailed log from the crash in Release build: crash.log
I have tested on multiple phones with Android 10 and Android 14. It always works in Debug mode but crashes instantly in Release mode. Please help.
Flutter: 3.24.1 (latest version)
flutter_stripe: 11.0.0 (latest version)
Also, I have done every single installation step as described here:
https://pub.dev/packages/flutter_stripe
That's the piece of code that shows the payment sheet:
Video from Debug build (works):
https://github.com/user-attachments/assets/ef3eba99-6180-4f5a-8a09-0933f76e5641
Video from Release build (crashes):
https://github.com/user-attachments/assets/bc5daedd-4ef3-4fcf-9116-17815776cddc
This blocks me from releasing the app to production as the payment feature is the core functionality here. The only thing I need for my MVP is to allow customers to pay by card. Nothing else is required at this stage and even this scenario does not work. And I don't want to publish a Debug version to production...
Please help. I have invested lots of time integrating Stripe with my backend but it's not usable end to end as the mobile app (currently my only API client) is not working at all. Thank you.
Activity
remonh87 commentedon Sep 3, 2024
so deadobject exception means the paymentsheetactivity got killed by the android OS. Can it be that you do not have applied all the steps for android as described here?
I am using paymentsheet as well and do not have this issue
lokus1980 commentedon Sep 3, 2024
Yes @remonh87, I have done all the steps like in the instruction and getting:
Now, please look at my configuration and see if you can spot anything:
Pubspec.yaml:
main.dart:
styles.xml:
styles.xml (values-night):
android/build.gradle:
android/app/build.gradle:
proguard-rules.pro:
gradle-wraper.properties:
MainActivity.kt:
and the code that is presenting the payment sheet:
I am running out of ideas. I tried lots of things like fiddling with
customFlow
,targetSdkVersion
,flutter-stripe
version and still getting theandroid.os.DeadObjectException
. Also, I disabled my loader animation thinking that maybe it would come in the way but it also didn't help. My app is very simple, just a few screens for now and no crazy stuff except for a few calls to our REST API.Once again, the Debug build works, but the Release/Prod build fails, as shown in the log at the top.
Please help.
ibrahimMobileArts commentedon Sep 5, 2024
@lokus1980 can u please provide an image for settings.gradle file, and there are 3 things to try android/build.gradle:
wish u benefit from this
lokus1980 commentedon Sep 9, 2024
Hi @ibrahimMobileArts, I have applied your suggested changes and the app is still crashing.
Here's the content of my
settings.gradle
:I think there must be some weird bug in this library as, like I said, the app works in a Debug build (so all settings, libs and things are like they should) but in a Release build it crashes when I try to shoe the Payment Sheet. I don't know what else I can do to make it work in Release build. I'll try to run the demo app included in this library whether it works in Release build as if it suffers from the same problem, you would have a case that is easy to reproduce on your end.
Also, what did you mean exactly by "first you should know that there is an updated syntax for this whole file"?
Can you please send an example of the correct syntax so I can try it?
lokus1980 commentedon Sep 9, 2024
OK, the demo app (that is included in this library) crashes at the same point as my app.
I just launched the server and then the app, went to the payment sheet screen and it crashes with my test Stripe keys:
Here's the video of the crash:
https://github.com/user-attachments/assets/5b6d5453-94c3-4d9e-85ed-05dcfe1303fa
So the problem seems to be in the library, not in my app.
Please launch the demo app in a Release mode and you will see the crash on your end too :)
Just try
flutter run --release
.ibrahimMobileArts commentedon Sep 9, 2024
this is an example, even though i don't think its the problem anymore:
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
id 'com.google.gms.google-services'
id "com.google.firebase.crashlytics"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}
android {
namespace = "app.app.app"
compileSdk = 34
ndkVersion = flutter.ndkVersion
}
flutter {
source = "../.."
}
dependencies {
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:33.1.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.stripe:stripe-android:20.37.2'
implementation 'com.google.android.gms:play-services-wallet:19.3.0'
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}
lokus1980 commentedon Sep 9, 2024
Hi @ibrahimMobileArts and @remonh87.
As in my previous message, the demo app included in this library crashes the same way as my app in Release mode.
Video: https://github.com/user-attachments/assets/5b6d5453-94c3-4d9e-85ed-05dcfe1303fa
Below is the log from the crash.
I have tested it both with Stripe test and live API keys. That's a serious bug I think. It crashes the same way on emulators and real devices (like a stock Google Pixel 6 with Android 14). This makes this Flutter library unusable in production.
Can you please run the demo app in Release mode (
flutter run --release
or deploy the apk build byflutter build apk
) to reproduce the error on your end and see if you can fix it please?And that's my flutter doctor report again if that helps:
Also, my Java (as maybe here there's something wrong?):
ibrahimMobileArts commentedon Sep 10, 2024
@lokus1980 hello, sorry am not sure about your problem exactly, however please try few things i foundx while comparing to my working code:
lokus1980 commentedon Sep 10, 2024
Hi @ibrahimMobileArts, before I try your suggestions, can you please check a few things for me?
The video you saw in my previous message is not from my app but the demo app included in this library. It's crashing on all my Android phones too. Please download it here: https://github.com/flutter-stripe/flutter_stripe/tree/main/example
flutter run --release
)? Are you using Payment Sheet in your app? This one is crashing on the demo app.flutter run --release
) and select Customer Sheet and then "Init customer sheet" and "Select payment method now"?ibrahimMobileArts commentedon Sep 10, 2024
@lokus1980 i just finished running my app using flutter run --release and i made a payment and everything works fine, did you try the library's demo app on android 12 or below?
lokus1980 commentedon Sep 10, 2024
Thank you @ibrahimMobileArts for checking this!
Are you making payments in your app via Payment Sheet (https://docs.page/flutter-stripe/flutter_stripe/sheet)?
Can you please share what Flutter and Java version you have on your machine?
Are you running everything on Mac or Windows?
ibrahimMobileArts commentedon Sep 10, 2024
Flutter 3.24.1 / Dart 3.5.1
java version "1.8.0_421"
running on Mac
52 remaining items