无法生成Flutter Android内部版本:从服务器接收到状态代码502:坏网关



嗨,我正在尝试构建我的flutter应用程序(调试/发布(。昨天之前一切都很好,但今天早上开始如果我构建我的应用程序(调试/发布(,我将面临以下异常

FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:processDevDebugResources'.
> Could not resolve all task dependencies for configuration ':app:devDebugRuntimeClasspath'.
> Could not resolve com.google.android.gms:play-services-location:16.+.
Required by:
project :app > project :location
> Failed to list versions for com.google.android.gms:play-services-location.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

这些是我的长笛和飞镖版本:

  • Flutter 2.5.3
  • 飞镖2.14.4

位置插件:

location: ^4.3.0

grade.properties中的分发URL:

distributionUrl=https://services.gradle.org/distributions/gradle-7.2-all.zip

项目级别等级:

buildscript {
ext.kotlin_version = '1.4.21'
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

感谢您对我的问题的回复。花了很长时间后,我找到了解决办法。

我遵循了以下步骤:

将grade.properties文件更新为:

distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip

将项目级build.gradle文件中的依赖项更新为:

classpath 'com.android.tools.build:gradle:4.0.1'

清洁并获得pug:

flutter clean
flutter pub get

现在构建您的项目。它成功地工作了。

我想我的问题与distributionUrl有关

相关内容

最新更新