flutter 我的手机上未显示Google Pay按钮

sdnqo3pr  于 2022-12-27  发布在  Flutter
关注(0)|答案(2)|浏览(199)

我试图整合谷歌支付,但按钮不出现,我创建另一个项目来测试这是我得到的错误。
在模拟器中,按钮至少出现,但在我的手机没有。
编辑:我刚刚发现,在模拟器与API 30不工作,但31和33它。
调试应用程序在我的手机我得到了这个:

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

谷歌支付按钮谁需要在资产的JSON:

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(),
              ),
            ),

我的pubspec.yaml

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

6ju8rftf1#

您需要在pubspec.yaml中声明资源:

flutter:
  assets:
    - assets/default_payment_profile_google_pay.json
bxpogfeg

bxpogfeg2#

pubspec.yaml文件中添加:

flutter:
  assets:
    - assets/

相关问题