在Flutter中集成条带支付 [英] Integrating Stripe Payment in Flutter

查看:171
本文介绍了在Flutter中集成条带支付的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Flutter应用程序中集成Stripe Payment Gateway,并且正在关注以下链接

I am trying to integrate Stripe Payment Gateway in Flutter app and i am following below link

https://pub.dartlang.org/packages/stripe_payment

但不幸的是,我遇到了错误.我正在使用依赖项: stripe_payment:^ 0.1.0.但是我遇到错误了

But unfortunately i am getting error. I am using dependencies: stripe_payment: ^0.1.0. But i am getting below error

失败:构建失败,并出现异常.

FAILURE: Build failed with an exception.

  • 出了什么问题: 任务':stripe_payment:compileDebugKotlin'的执行失败.

  • What went wrong: Execution failed for task ':stripe_payment:compileDebugKotlin'.

编译错误.请参阅日志以获取更多详细信息

Compilation error. See log for more details

  • 尝试: 使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    https://help.gradle.org

    41秒内失败 错误完成:Gradle任务assembleDebug失败,退出代码为1

    BUILD FAILED in 41s Finished with error: Gradle task assembleDebug failed with exit code 1

    任何人都可以帮助我进行整合.

    Can anyone please help me to integrate.

    推荐答案

    在您的\ android \ app \ src \ main \ java \ com \ example \ yourProjectName \ MainActivity.java中 文件,您应该具有与以下代码相似的代码:

    In your \android\app\src\main\java\com\example\yourProjectName\MainActivity.java file you should have code similar to the code below:

    package com.example.yourProjectName;
    
    import android.os.Bundle;
    //import io.flutter.app.FlutterActivity;
    import io.flutter.app.FlutterFragmentActivity;
    import io.flutter.plugins.GeneratedPluginRegistrant;
    
    //public class MainActivity extends FlutterActivity {
    public class MainActivity extends FlutterFragmentActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        GeneratedPluginRegistrant.registerWith(this);
      }
    }
    

    为了适用于版本^ 0.1.0, 将此添加到您项目的android/gradle.properties文件中

    In order it works for version ^0.1.0, include this into your project's android/gradle.properties file

    android.useAndroidX=true
    android.enableJetifier=true
    

    这篇关于在Flutter中集成条带支付的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆