【问题标题】:Flutter Execution failed for task ':stripe_android:compileDebugKotlin'. Android stripe integration任务“:stripe_android:compileDebugKotlin”的颤振执行失败。 Android 条带集成
【发布时间】:2022-06-11 22:59:32
【问题描述】:

我在将条纹与颤振 v3 在 android 中集成时遇到问题,它在 web chrome 中构建没有问题,一切都按照 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() {
}

还有

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

还更改了 min sdk 21 在调试模式下在 Infinix X5515F 上启动 lib/main.dart... 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' 不是抽象的,也没有实现抽象基类成员 public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView 在 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' 不覆盖任何内容 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' 不是抽象的,也没有实现抽象基类成员 public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView 在 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' 不会覆盖任何内容 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' 不是抽象的,也没有实现抽象基类成员 public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView 在 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' 不会覆盖任何内容

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' 不是抽象的,不实现抽象基类成员 public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView 定义在 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' 不会覆盖任何内容

FAILURE:构建失败并出现异常。

  • 出了什么问题: 任务 ':stripe_android:compileDebugKotlin' 执行失败。

编译错误。查看日志了解更多详情

  • 试试:

使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志输出。 运行 --scan 以获得完整的见解。

  • https://help.gradle.org 获得更多帮助 26 秒内构建失败 异常:Gradle 任务 assembleDebug 失败,退出代码为 1 退出(sigterm)

【问题讨论】:

  • 尝试flutter clean,可能有助于解决这个问题。
  • 试过了,没用
  • 您可能希望与社区/维护者联系,以获取您用于 Stripe 的第 3 方 Flutter 库(Stripe 目前没有他们维护的库)。

标签: flutter build.gradle flutter-dependencies flutter-test


【解决方案1】:

您的文件 styles.xml 不同:

&lt;style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt;

&lt;style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"&gt;

AppCompat 变体需要出现在两个 styles.xml 中。

使用这个包:

https://pub.dev/packages/flutter_stripe.

【讨论】:

    猜你喜欢
    • 2021-11-01
    • 2020-04-04
    • 1970-01-01
    • 2020-05-30
    • 2021-08-30
    • 1970-01-01
    • 2022-09-23
    • 1970-01-01
    • 2020-03-29
    相关资源
    最近更新 更多