Gradle can't find repositories to compile in flutter

Viewed 135

I am developing an app in flutter 2.8.1 with firebase as backend. I have already advanced the project, and everything was going perfectly, but when I try to install the flutterfire_ui plugin the compiler gives the following error in the console.

 FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find play-services-auth-20.0.1.aar (com.google.android.gms:play-services-auth:20.0.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-auth/20.0.1/play-services-auth-20.0.1.aar
   > Could not find play-services-auth-api-phone-18.0.1.aar (com.google.android.gms:play-services-auth-api-phone:18.0.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-auth-api-phone/18.0.1/play-services-auth-api-phone-18.0.1.aar
   > Could not find play-services-auth-base-18.0.1.aar (com.google.android.gms:play-services-auth-base:18.0.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-auth-base/18.0.1/play-services-auth-base-18.0.1.aar
   > Could not find play-services-base-18.0.1.aar (com.google.android.gms:play-services-base:18.0.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-base/18.0.1/play-services-base-18.0.1.aar
   > Could not find play-services-tasks-18.0.1.aar (com.google.android.gms:play-services-tasks:18.0.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-tasks/18.0.1/play-services-tasks-18.0.1.aar
   > Could not find play-services-basement-18.0.0.aar (com.google.android.gms:play-services-basement:18.0.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-basement/18.0.0/play-services-basement-18.0.0.aar

* 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

However none of the other firebase plugins give any problems, I can even access the links from the browser and download the files

build.gradle in android\app

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 GradleException("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.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {

    compileSdkVersion 30

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

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

  signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}
buildTypes {
    release {
        signingConfig signingConfigs.release
    }
}

}

flutter {
    source '../..'
}

dependencies {
    
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    
}

build.gradle in android/

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

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

allprojects {
    repositories {
        mavenCentral()
        google()
        
        
    }
}

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

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

These are the dependencies in pubspec.yaml

  cupertino_icons: ^1.0.2
  cloud_firestore: ^3.1.6
  firebase_core: ^1.11.0
  image_picker: ^0.8.4+1
  firebase_storage: ^10.2.5
  animate_do: ^2.1.0
  firebase_auth: ^3.3.5
  getwidget: ^2.0.4
  flutter_rating_bar: ^4.0.0
  flutter_launcher_icons: ^0.9.2
  flutterfire_ui: ^0.3.1  <======The error appears when adding this

I would appreciate any help you can give me.

0 Answers
Related