Flutter Android App crashes on start when use stripe_payment

1,294

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
Share:
1,294
michealchow
Author by

michealchow

Updated on December 09, 2022

Comments

  • michealchow
    michealchow over 1 year

    I am trying to use stripe_payment on my Flutter apps. It works fine on IOS simulators, but the app crashed instantly on Android.

    I tried to put the stripe_payment package to a new project, and the app crashed on start as well.

    The package version I'm using is: stripe_payment: ^0.0.9

    Does anyone know how to use the package properly? Thanks a lot !

  • michealchow
    michealchow about 5 years
    I got this message when I build the app with stripe_payment 0.1.0 Execution failed for task ':stripe_payment:compileDebugKotlin'. I think I need to update the sdk version right?
  • Abdul Qadir
    Abdul Qadir about 3 years
    this is for android studio may be. How can I resolve this from Visual Studio Code. can you please help me out