flutter_background_fetch
flutter_background_fetch copied to clipboard
Received status code 502 from server: Bad Gateway!! Was Working fine till yesterday.
- Plugin version: 1.0.3
- Platform: Android
- OS version: 10
- Device manufacturer / model: Redmi 9A
- Flutter info (
Flutter 2.5.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 3595343e20 (9 weeks ago) • 2021-09-30 12:58:18 -0700 Engine • revision 6ac856380f Tools • Dart 2.14.3,Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.19042.1348], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.4)
[√] Android Studio (version 2020.3) [√] Connected device (2 available)
• No issues found!`):
Could not GET 'https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
Same here:
`FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.Could not resolve com.transistorsoft:tsbackgroundfetch:+. Required by: project :app > project :background_fetch > Failed to list versions for com.transistorsoft:tsbackgroundfetch. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml. > Could not get resource 'https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'. > Could not GET 'https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'. Received status code 502 from server: Bad Gateway`
Post your android/build.gradle
android/build.gradle:
buildscript {
ext.kotlin_version = '1.5.10' // Must use 1.3.0 or higher.
ext {
compileSdkVersion = 30 // or higher
targetSdkVersion = 30 // or higher
appCompatVersion = "1.0.2" // or higher
playServicesLocationVersion = "17.0.0" // or higher
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven {
// [required] flutter_background_geolocation
url "${project(':flutter_background_geolocation').projectDir}/libs"
}
maven {
// [required] background_fetch
url "${project(':background_fetch').projectDir}/libs"
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please learn to syntax highlight code blocks
Done, sorry @christocracy
Do you know that the jcenter() repository is deprecated?
Look at the repositories sections of a freshly generated flutter app:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Look at the android/build.gradle of the /example app here in this repo.
Yep thanks for that, I took the example of the build gradle. I still have the issue
Could not GET 'https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

I have no idea why your app is attempting to find maven-metadata.xml from google.bintray.com. The maven-metadata.xml exists within the plugin
Post your updated android/build.gradle.
i got the same on this issue
background_fetch: 1.0.3
This is my updated android/build.gradle
buildscript {
ext.kotlin_version = '1.5.31'
ext {
compileSdkVersion = 30
targetSdkVersion = 30
supportLibVersion = "1.3.1"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
// [required] background_fetch
url "${project(':background_fetch').projectDir}/libs"
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I just generated a fresh flutter app $ flutter create foo. Followed the installation steps here in this repo and the app boots without issue.
@nhoangthinh See my comment above. I'm not looking at your posted code until you Syntax Highlight it.
buildscript {
ext.kotlin_version = '1.5.31' // Must use 1.3.0 or higher.
ext {
compileSdkVersion = 30 // or higher
targetSdkVersion = 30 // or higher
appCompatVersion = "1.3.1" // or higher
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
// [required] background_fetch
url "${project(':background_fetch').projectDir}/libs"
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
@nhoangthinh See my comment above. I'm not looking at your posted code until you Syntax Highlight it. sorry @christocracy , i updated my code
I have no idea what your problem is. When in doubt, clean your build.
$ cd android
$ ./gradlew clean
and $ flutter upgrade
Still the same bug. Like you said, my app is attempting to find maven-metadata.xml from google.bintray.com. instead of searching for the one within the plugin.
I tried:
- Updating Flutter (
$ flutter ugprade) - Cleaning my build (
$ ./gradlew clean)
About my app/versions:
- My app is updated post-1.12
- Flutter 2.6.0-12.0.pre.854
- Dart 2.16.0 (build 2.16.0-55.0.dev) • DevTools 2.8.0
- Gradle 6.3
I suggest you generate yourself a fresh flutter app, follow the setup instructions and verify the plugin builds fine.
I got the same problem from yesterday
Create for me a freshly generated flutter app which reproduces this then share that repo with me.
There changes in android/build.gradle seen to work for me.
buildscript {
ext.kotlin_version = '1.4.0' // Must use 1.3.0 or higher.
ext {
compileSdkVersion = 30 // or higher
targetSdkVersion = 30 // or higher
appCompatVersion = "1.2.0" // or higher
}
repositories {
google()
- jcenter()
+ mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.0.1'
+ classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
}
}
allprojects {
repositories {
google()
- jcenter()
maven {
// [required] background_fetch
url "${project(':background_fetch').projectDir}/libs"
}
+ mavenCentral {
+ content {
+ excludeGroupByRegex "com\\.google\\.android\\.gms"
+ }
+ }
}
}
The issue is back today, Maven is seeing this mention in build.gradle:
implementation(group: 'com.transistorsoft', name:'tsbackgroundfetch', version: '+')
and tries to get it from Bintray repository, but since bintray repository is sunset since this December it fails to get it. It's a good question why is it trying to get it from a remote repo and not local file inside plugin, but we have to force it using the local one somehow.
Replacing the + version with an actual version name fixed the problem for me
implementation(group: 'com.transistorsoft', name:'tsbackgroundfetch', version: '+') —> implementation(group: 'com.transistorsoft', name:'tsbackgroundfetch', version: '0.5.0')
Also, the order of repositories matters, make sure you put
maven {
url './libs'
}
above google() and mavenCentral()
My problem it's same. My debug showing this problem today. How solve this error?

Thanks a lot @asmodeoux.
@G-Luz,
in app/build.gradle, add the following line:
implementation(group: 'com.transistorsoft', name:'tsbackgroundfetch', version: '0.5.0')
in build.gradle, add the following lines BEFORE google() and mavenCentral():
maven { url './libs' }
Thanks a lot @asmodeoux. @G-Luz, in app/build.gradle, add the following line:
implementation(group: 'com.transistorsoft', name:'tsbackgroundfetch', version: '0.5.0')in build.gradle, add the following lines BEFORE google() and mavenCentral():maven { url './libs' }
Thank you for reply. I continue received error, but it's a new error:

My app/build.gradle:
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation(group: 'com.transistorsoft', name:'tsbackgroundfetch', version: '0.5.0')
}
apply plugin: 'com.google.gms.google-services'
My android/build.gradle:
buildscript {
ext.kotlin_version = '1.3.0' // Must use 1.3.0 or higher.
ext {
compileSdkVersion = 29 // or higher
targetSdkVersion = 29 // or higher
appCompatVersion = "1.0.2" // or higher
playServicesLocationVersion = "17.0.0" // or higher
}
repositories {
maven { url './libs' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.2'
}
}
allprojects {
repositories {
maven { url './libs' }
google()
jcenter()
}
}
@G-Luz Look at the build.gradle from a freshly generated Flutter app that I posted above. Notice there is no jcenter.
You should not see jcenter at all. jcenter is DEAD
Yes jcenter is DEAD, sorry. I send my build.gradle before make new changes (change to mavenCentral).
My output after change to mavenCentral():

My android/build.gradle:
buildscript {
ext.kotlin_version = '1.3.0' // Must use 1.3.0 or higher.
ext {
compileSdkVersion = 29 // or higher
targetSdkVersion = 29 // or higher
appCompatVersion = "1.0.2" // or higher
playServicesLocationVersion = "17.0.0" // or higher
}
repositories {
maven { url './libs' }
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.2'
}
}
allprojects {
repositories {
maven { url './libs' }
google()
mavenCentral()
}
}