0

i am facing issue while integrating stripe with flutter v3 in android, its building in web chrome with no issue, everything done as per flutter stripe docs for android

/android/app/src/main/res/values/styles.xml

<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.

         This Theme is only used starting with V2 of Flutter's Android embedding. -->
        <style name="NormalTheme" parent="Theme.MaterialComponents">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

android/app/src/main/res/values-night/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
    <!-- TODO document the necessary change -->
    <style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.
         
         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="Theme.MaterialComponents">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

Mainactivity.kt

package com.example.ecomm

 

import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity: FlutterFragmentActivity() {
}

also

dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
}

also changed min sdk 21 Launching lib/main.dart on Infinix X5515F in debug mode... e: /home/diljith/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_android-2.5.0/android/src/main/kotlin/com/flutter/stripe/StripeAubecsDebitPlatformViewFactory.kt: (13, 1): Class 'StripeAubecsDebitPlatformViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory e: /home/diljith/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_android-2.5.0/android/src/main/kotlin/com/flutter/stripe/StripeAubecsDebitPlatformViewFactory.kt: (19, 5): 'create' overrides nothing e: /home/diljith/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_android-2.5.0/android/src/main/kotlin/com/flutter/stripe/StripeSdkCardFormPlatformViewFactory.kt: (12, 1): Class 'StripeSdkCardFormPlatformViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory e: /home/diljith/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_android-2.5.0/android/src/main/kotlin/com/flutter/stripe/StripeSdkCardFormPlatformViewFactory.kt: (18, 5): 'create' overrides nothing e: /home/diljith/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_android-2.5.0/android/src/main/kotlin/com/flutter/stripe/StripeSdkCardPlatformViewFactory.kt: (12, 1): Class 'StripeSdkCardPlatformViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory e: /home/diljith/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_android-2.5.0/android/src/main/kotlin/com/flutter/stripe/StripeSdkCardPlatformViewFactory.kt: (18, 5): 'create' overrides nothing

e: /home/diljith/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_android-2.5.0/android/src/main/kotlin/com/flutter/stripe/StripeSdkGooglePayButtonPlatformViewFactory.kt: (12, 1): Class 'StripeSdkGooglePayButtonPlatformViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory e: /home/diljith/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/stripe_android-2.5.0/android/src/main/kotlin/com/flutter/stripe/StripeSdkGooglePayButtonPlatformViewFactory.kt: (18, 5): 'create' overrides nothing

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':stripe_android: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 26s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)
3
  • Try to flutter clean, it might help to resolve this issue. Commented Jun 9, 2022 at 7:49
  • tried ,but no use Commented Jun 9, 2022 at 12:16
  • You will likely want to reach out to the community/maintainers for whichever 3rd party Flutter library you're using for Stripe (Stripe doesn't currently have one they maintain). Commented Jun 9, 2022 at 13:18

3 Answers 3

5

I've successfully resolved the "Task :stripe_android:compileDebugJavaWithJavac FAILED" error by adding the following dependency override in my project:

dependency_overrides:
  stripe_android: "9.5.0+1"

This adjustment worked for me. Feel free to give it a try and let me know if it resolves the issue on your end as well.

Sign up to request clarification or add additional context in comments.

Comments

0

Your files styles.xml differ, the AppCompat variant needs to be present in both files:

OK:

<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar">

Not OK:

<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">

build.gradle compile settings, working for me:


android {

    compileSdkVersion 31 

    defaultConfig {
        
        minSdkVersion 21 
        targetSdkVersion 31 
    }
}

Referring to this package: https://pub.dev/packages/flutter_stripe.

Comments

0

Go to your android < settings.gradle

go to plugins in the third line check you kotlin version or replace this line

id "org.jetbrains.kotlin.android" version "1.8.10" apply false

1.8.10 this is your kotlin version

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.