flutter_stripe 构建失败,android 出现异常
flutter_stripe Build failed with an exception on android
我正在使用 flutter_stripe 插件进行条纹支付。它在 IOS 上工作,但在 android 上工作,我收到此错误。根据 flutter_stripe 文档为 android 和 ios..
完成的所有设置
失败:构建失败,出现异常。
- 出了什么问题:
任务“:app:checkDebugAarMetadata”执行失败。
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not resolve com.stripe:stripe-android:20.1.+.
Required by:
project :app > project :stripe_android
> Failed to list versions for com.stripe:stripe-android.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
尝试:
运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。 运行 使用 --scan 以获得完整的见解。
- 获取更多帮助
6 米 3 秒后构建失败
[!] Gradle 从网络下载工件时出现错误。正在重试下载...
android/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()。但得到同样的错误
我分叉并修复了它。
1.Fork flutter_stripe
2.Replace com.stripe:stripe-android
(flutter_stripe/packages/stripe_android/android/build.gradle
)
Add stripe-android to your build.gradle dependencies.
dependencies {
implementation 'com.stripe:stripe-android:20.4.0'
}
3.Replace 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
我正在使用 flutter_stripe 插件进行条纹支付。它在 IOS 上工作,但在 android 上工作,我收到此错误。根据 flutter_stripe 文档为 android 和 ios..
完成的所有设置失败:构建失败,出现异常。
- 出了什么问题: 任务“:app:checkDebugAarMetadata”执行失败。
Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not resolve com.stripe:stripe-android:20.1.+. Required by: project :app > project :stripe_android > Failed to list versions for com.stripe:stripe-android. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml. > Could not get resource 'https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml'. > Could not GET 'https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
尝试: 运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。 运行 使用 --scan 以获得完整的见解。
- 获取更多帮助
6 米 3 秒后构建失败 [!] Gradle 从网络下载工件时出现错误。正在重试下载...
android/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()。但得到同样的错误
我分叉并修复了它。
1.Fork flutter_stripe
2.Replace com.stripe:stripe-android
(flutter_stripe/packages/stripe_android/android/build.gradle
)
Add stripe-android to your build.gradle dependencies.
dependencies {
implementation 'com.stripe:stripe-android:20.4.0'
}
3.Replace 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