How to solve gradle googleplayservices version error in flutter?

2,373

the issue actually stems from this one dependency here:

Project 'app' depends on project 'firebase_storage' which depends onto
com.google.firebase:firebase-storage@15.+

this means, that pubspec.yaml needs this one dependency updated:

firebase_storage: ^1.0.4

as the documentation states for 1.0.4 from Oct 12, 2018 bump Android dependencies to latest.

Share:
2,373
Bishal Das
Author by

Bishal Das

Updated on December 08, 2022

Comments

  • Bishal Das
    Bishal Das over 1 year

    I am getting a google play services error in android studio and i am using flutter. I have tried various solutions but nothing seems to work.

    I have tried to change the version of googleplayservices but its the same.

    Failed to capture fingerprint of input files for task 
    ':app:checkDebugClasspath' property 'compileClasspath' during up-to-date 
    check.
    > In project 'app' a resolved Google Play services library dependency 
    depends on another at an exact version (e.g. "[15.0.
    1]", but isn't being resolved to that version. Behavior exhibited by the 
    library will be unknown.
    
    Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> 
    com.google.android.gms:play-services-basement@[
    15.0.1], but play-services-basement version was 16.0.1.
    
    The following dependencies are project dependencies that are direct or have 
    transitive dependencies that lead to the art
    ifact with the issue.
     -- Project 'app' depends on project 'firebase_auth' which depends onto 
    com.google.firebase:[email protected]
     -- Project 'app' depends on project 'firebase_core' which depends onto 
    com.google.firebase:[email protected]
     -- Project 'app' depends on project 'cloud_firestore' which depends onto 
    com.google.firebase:[email protected]
      -- Project 'app' depends on project 'firebase_storage' which depends onto 
    com.google.firebase:firebase-storage@15.+
     -- Project 'app' depends on project 'google_sign_in' which depends onto 
    com.google.android.gms:[email protected]
    
     For extended debugging info execute Gradle from the command line with 
    ./gradlew --info :app:assembleDebug to see the dep
     endency paths to the artifact. This error message came from the google- 
    services Gradle plugin, report issues at https://
      github.com/google/play-services-plugins and disable by adding 
    "googleServices { disableVersionCheck = false }" to your b
      uild.gradle file.
    

    build.gradle(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.android.application'
    apply plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    
    android {
    compileSdkVersion 27
    
    
    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 "com.example.news"
        minSdkVersion 16
        multiDexEnabled true
        targetSdkVersion 27
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
    }
    
    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` 
    works.
            signingConfig signingConfigs.debug
        }
    }
    }
    
    flutter {
    source '../..'
      }
    
    dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso- 
    core:3.0.2'
    implementation 'com.android.support:multidex:1.0.3'
    }
    
    apply plugin: 'com.google.gms.google-services'
    

    build.gradle/project

    buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        google()
        jcenter()
    }
    
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
    }
    }
    
    allprojects {
    repositories {
        google()
        jcenter()
    }
    ext {
        global_version_firebase = '16.0.+'
    }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
    project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
    delete rootProject.buildDir
    }
    

    pubspec.yaml

    name: news
    description: 'A new Flutter application.'
    version: 1.0.0+1
    environment:
    sdk: '>=2.0.0-dev.68.0 <3.0.0'
    dependencies:
    flutter:
        sdk: flutter
    cupertino_icons: ^0.1.2
    http: null
    share: null
    connectivity:
    url_launcher:
    cloud_firestore:
    rxdart:
    firebase_auth: ^0.5.19
    google_sign_in:
    date_format:
    intl:
    firebase_storage: ^0.3.7
    image_picker:
    
    dev_dependencies:
    flutter_test:
        sdk: flutter
    flutter:
    uses-material-design: true
    assets:
        - images/logo.jpg
        - images/fb.jpg
        - images/back.jpg
        - images/google.jpg
    

    please help me to solve this error. Thank you

  • Bishal Das
    Bishal Das over 5 years
    ya i know but the latest gradle version has removed future from the storageUploadTask class and i need that...so i downgraded the version...
  • Martin Zeitler
    Martin Zeitler over 5 years
    @BishalDas this answer hints for not chaining it: stackoverflow.com/a/44285632/549372