0

**android/build.gradle:**

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

app/build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 31

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId ""
        minSdkVersion 23
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            storeFile file("")
            storePassword ""
            keyAlias ""
            keyPassword ""
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics:17.5.0'
}
**yaml:**
environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  location: 4.3.0 # ^3.2.4
  firebase_auth: 3.1.1 #0.18.4+1
  url_launcher: 6.0.10
  firebase_messaging: 10.0.7
  flutter_polyline_points: 1.0.0 #^0.2.3
  google_maps_flutter: 2.0.8
  geolocator: 7.6.0
  image_picker: 0.7.4
  cached_network_image: 3.1.0
  shared_preferences: 2.0.6
  flutter:
    sdk: flutter
 cupertino_icons: ^0.1.3

dependency_overrides:
  platform: ^3.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter
flutter:
uses-material-design: true

  assets:
    - assets/
    - assets/fonts/

  fonts:
    - family: Raleway
      fonts:
        - asset: assets/fonts/Raleway-Bold.ttf
          weight: 800
        - asset: assets/fonts/Raleway-Light.ttf

I am new to flutter project.When i try to build the app, It shows

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:mergeReleaseAssets'.

Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. 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 fr om 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 15s Running Gradle task 'bundleRelease'... 16.0s [!] Gradle threw an error while downloading artifacts from the network. Retrying to download... Gradle task bundleRelease failed with exit code 1

Flutter doctor Flutter 2.10.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision 5464c5bac7 (3 weeks ago) • 2022-04-18 09:55:37 -0700 Engine • revision 57d3bac3dd Tools • Dart 2.16.2 • DevTools 2.9.2

Hope anyone help me to overcome from this error.

0 Answers0