Home > Mobile >  The Google Pay button doesn't appears on my phone
The Google Pay button doesn't appears on my phone

Time:12-27

I´m trying to integrate google pay but the button doesn't appears, i create another project to test in this is the error i got.

in the emulator the button at least appears but in my phone not.

Edit: I just discover that in emulator with API 30 doesn't work but 31 and 33 it does.

debugging the app in my phone i got this:

W/Activity(27610): PerfMonitor: Slow Operation: Activity com.example.gpay/.MainActivity onDestroy took 202ms
D/AppScoutStateMachine(27610): 27610-ScoutStateMachinecreated
D/DecorView[](27610): getWindowModeFromSystem  windowmode is 1
D/SurfaceView(27610): UPDATE null, mIsCastMode = false
D/SurfaceView(27610): UPDATE Surface(name=SurfaceView[com.example.gpay/com.example.gpay.MainActivity])/@0xffd4333, mIsProjectionMode = false
D/SurfaceControl(27610): nativeSetScreenProjection ===> setScreenProjection

The google pay button who needs the json in assets:

            GooglePayButton(
              paymentConfigurationAsset:
                  'default_payment_profile_google_pay.json',
              paymentItems: _paymentItems,
              type: GooglePayButtonType.pay,
              margin: const EdgeInsets.only(top: 15.0),
              onPaymentResult: print,
              loadingIndicator: const Center(
                child: CircularProgressIndicator(),
              ),
            ),

My pubspec.yaml

flutter:
  uses-material-design: true
  assets:
    - assets/

CodePudding user response:

You need to declare your resources in pubspec.yaml:

flutter:
  assets:
    - assets/default_payment_profile_google_pay.json

CodePudding user response:

in pubspec.yaml file add:

flutter:
  assets:
    - assets/
  • Related