Home > Back-end >  Gradle Could not GET. Received status code 502 from server: Bad Gateway
Gradle Could not GET. Received status code 502 from server: Bad Gateway

Time:10-24

When I add image_picker: ^0.6.5 3 as a dependency in my pubspec.yaml file, I get the following:

Terminal Output:

Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
lib/main.dart:1

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.google.android.gms:play-services-measurement-base:[21.1.1].
     Required by:
         project :app > com.google.firebase:firebase-analytics:21.1.1 > com.google.android.gms:play-services-measurement:21.1.1
         project :app > com.google.firebase:firebase-analytics:21.1.1 > com.google.android.gms:play-services-measurement-api:21.1.1
         project :app > com.google.firebase:firebase-analytics:21.1.1 > com.google.android.gms:play-services-measurement-sdk:21.1.1
         project :app > com.google.firebase:firebase-analytics:21.1.1 > com.google.android.gms:play-services-measurement:21.1.1 > com.google.android.gms:play-services-measurement-impl:21.1.1
         project :app > com.google.firebase:firebase-analytics:21.1.1 > com.google.android.gms:play-services-measurement-api:21.1.1 > com.google.android.gms:play-services-measurement-sdk-api:21.1.1
      > Failed to list versions for com.google.android.gms:play-services-measurement-base.
         > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-measurement-base/maven-metadata.xml.
            > Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-measurement-base/maven-metadata.xml'.
               > Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-measurement-base/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

build.gradle:

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.13'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Flutter doctor -v:

[✓] Flutter (Channel stable, 1.22.6, on macOS 12.5 21G72 darwin-x64, locale
    en-US)
    • Flutter version 1.22.6 at /Library/flutter
    • Framework revision 9b2d32b605 (1 year, 9 months ago), 2021-01-22 14:36:39
      -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/jcastro2/Library/Android/sdk
    • Platform android-32, build-tools 30.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.12 0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 14.0.1, Build version 14A400
    • CocoaPods version 1.11.2

[!] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build
      11.0.12 0-b1504.28-7817840)

[✓] VS Code (version 1.72.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (1 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12
      (API 31) (emulator)

! Doctor found issues in 1 category.

pubspec.yaml

name: chat_app
description: A new Flutter project.

publish_to: 'none'

version: 1.0.0 1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore: ^0.13.5
  firebase_auth: 0.16.1
  image_picker: ^0.6.5 3

  cupertino_icons: ^1.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  change_app_package_name: ^0.1.3

flutter:
  uses-material-design: true

CodePudding user response:

You have packages that are way out of date. You need to 1) update your packages and 2) go back to the firebase documentation for flutter and follow the suggested steps since you are also missing firebase_core which is needed to use firebase_auth and cloud_firestore in your project.

  • Related