【问题标题】:flutter_stripe Build failed with an exception on androidflutter_stripe 构建失败,在 android 上出现异常
【发布时间】:2022-11-02 21:28:10
【问题描述】:

我正在使用 flutter_stripe 插件进行条带支付。它在 IOS 上运行,但在 android 上,我收到此错误。根据 flutter_stripe 文档,所有设置都为 android 和 ios 完成。

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

  • 出了什么问题: 任务“:app:checkDebugAarMetadata”执行失败。

无法解析配置“:app:debugRuntimeClasspath”的所有文件。 无法解析 com.stripe:stripe-android:20.1.+。 要求: 项目:应用程序>项目:stripe_android > 无法列出 com.stripe:stripe-android 的版本。 > 无法从 https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml 加载 Maven 元数据。 > 无法获取资源“https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml”。 > 无法获取“https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml”。从服务器收到状态码 502:Bad Gateway

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

  • https://help.gradle.org 获得更多帮助

在 6m 3s 内构建失败 [!] Gradle 在从网络下载工件时抛出错误。正在重新下载...

安卓/build.gradle

buildscript {
ext.kotlin_version = '1.6.10'
repositories {

    google()
   // mavenCentral()
    jcenter()


}

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.3' //4.1.3
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.3.10'

}

}

allprojects {
repositories {

    google()
    jcenter()
    //mavenCentral()
}

}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
    project.evaluationDependsOn(':app')
}

尝试了 jcenter() 和 mavenCentral()。但得到同样的错误

【问题讨论】:

    标签: android flutter flutter-stripe


    【解决方案1】:

    我分叉并修复了它。

    1. 分叉flutter_stripe

    2. 替换com.stripe:stripe-android** (flutter_stripe/packages/stripe_android/android/build.gradle)

      将 stripe-android 添加到您的 build.gradle 依赖项中。

      dependencies {
          implementation 'com.stripe:stripe-android:20.4.0'
      }
      

      reference

    3. 将 flutter_android 替换为您 fork 的存储库 flutter_stripe/packages/stripe/pubspec.yaml

      像这样

       dependencies:
         flutter:
           sdk: flutter
         stripe_android:
           git:
             url: https://github.com/<YourName>/flutter_stripe.git
             ref: <Branch Name>
             path: packages/stripe_android
      

      My Repository

    【讨论】:

    • 太感谢了。我通过更改为实现 'com.stripe:stripe-android:20.2.2' 来修复
    猜你喜欢
    • 1970-01-01
    • 2021-12-21
    • 1970-01-01
    • 2022-07-20
    • 2019-12-10
    • 1970-01-01
    • 2021-01-06
    • 2023-03-03
    相关资源
    最近更新 更多