-1

Flutter Square plugin crashes only in release when I use invalid card or press back. But when I use flutter run --release & hook up my mobile. the crashes don't occur & the app works perfectly!

here's the code we used

  void _pay() async {
await InAppPayments.setSquareApplicationId(sqAppId);
try {
  await InAppPayments.startCardEntryFlowWithBuyerVerification(
      money: Money((money) => money
        ..amount = 0
        ..currencyCode = 'USD'),
      collectPostalCode: true,
      contact: Contact((ContactBuilder contact) {
        return contact.givenName = username;
      }),
      buyerAction: "Store",
      squareLocationId: sqLocationId,
      onBuyerVerificationSuccess: (BuyerVerificationDetails result) {
        addCard(result.nonce, result.card.postalCode);
      },
      onBuyerVerificationFailure: (err) {
        return showErrorDialog(context, err.toString());
      },
      onCardEntryCancel: () {});
} on Exception catch (e) {
  print(e);
}

}

What is the difference between flutter build & flutter run --release ? Could I use the APK out from flutter run & upload it to google play ?

Kim
  • 15
  • 5

1 Answers1

0

In the release version you have to add the PERMISSIONS explicitly. Try adding android.permission.INTERNET to the Manifest file. Add <uses-permission android:name="android.permission.INTERNET"/> to the AndroidManifest.xml located in android/app/src/main.

For your question about uploading a debuggable apk, Google Play-Upload will reject your file.

Refer to this link for the differences between release and debug.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Red Root
  • 51
  • 8