Integrating Stripe Payment in Flutter

半城伤御伤魂 提交于 2020-01-13 07:06:34

问题


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

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

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.

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

    Compilation error. See log for more details

  • 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.

  • Get more help at https://help.gradle.org

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

Can anyone please help me to integrate.


回答1:


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);
  }
}

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



回答2:


As stated in the documentation of this plugin for Android:

Please be aware that your main activity must extend from FlutterFragmentActivity.



来源:https://stackoverflow.com/questions/55492162/integrating-stripe-payment-in-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!