Search code examples
androidfluttergoogle-play-servicesbraintree

com.google.android.gms:play-services-maps has reported version 16.0.0 as outdated


We have an Ecommerce Flutter application that uses flutter_braintree package for payment gateway (paypal, credit card etc).

It's been a few months since the dev/devs updated anything for the package. Today when we tried to publish an update on PlayStore, it threw a warning,

The developer of Maps SDK for Android (com.google.android.gms:play-services-maps) has reported version 16.0.0 as outdated. After 90 days from releasing this version of your app, you won't be able to release new versions which contain this SDK until you upgrade to a newer version (17.0.0+).

The package that has this dependency turns out to be flutter_braintree.

Now, the thing is, I have no idea of android development as I only work with Flutter.

What do I do now? because after 3 months PlayStore is not gonna allow me to publish an update.

I've asked this question on the package's repository as well. But I don't think I'll be getting any response anytime soon.

I've attached the flutter doctor response if someone needs to look through it.

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.6.8 21G725 darwin-x64, locale en-PK)
    • Flutter version 2.10.4 at /Users/macbookpro/src/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c860cba910 (1 year, 7 months ago), 2022-03-25 00:23:12 -0500
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/macbookpro/Library/Android/sdk
    • Platform android-34, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

This is the android/build.gradle file (of our app not the braintree)

 buildscript {
    ext.kotlin_version= "1.5.31"
    repositories {
        google()
        jcenter()
    }

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

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
}

This is the android/build.gradle file of the braintree package,

group 'com.example.flutter_braintree'
version '1.0'

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
    }
}

rootProject.allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
            credentials {
                username 'braintree'
                password 'abc'
            }
        }
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 21
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    lintOptions {
        disable 'InvalidPackage'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation 'com.braintreepayments.api:drop-in:5.2.1'
    implementation 'com.google.android.gms:play-services-wallet:16.0.1'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    components.all {
        allVariants {
            withDependencies { deps ->
                deps.each { dep ->
                    if (dep.group == 'net.minidev' && dep.name =='json-smart') {
                        dep.version {
                            prefer "2.3"
                        }
                        dep.because "resolving dependencies issue"
                    }
                }
            }
        }
    }
}

There are 2 files named ivy.xml in the entire project. One can be found in flutter_braintree_master/android/build folder in project directory of flutter_braintree (package) where I could see the line,

<dependency org="com.google.android.gms" name="play-services-maps" rev="16.0.0" transitive="false" conf="releaseCompileClasspath-&gt;default"/>

And the other one can be found in android/build folder in main_project/ios/.symlinks/plugins/flutter_braintree/android/ivy.xml, where I could see the similar line as,

<dependency org="com.google.android.gms" name="play-services-maps" rev="16.0.0" transitive="false" conf="releaseCompileClasspath-&gt;default"/>

may be this is causing the issue?


Solution

  • Had the same problem. Finding dependency is not always so simple at least with flutter app. To find which app uses dependency:

    1. Go to FlutterAPP/android directory
    2. Run: gradlew app:dependencies
    3. Find which one uses dependecny in output
    4. Update package to higher version.

    If package has no newer version, try to fix it manually:

    Go to Flutter Pub folder, then search Cache\hosted\pub.dev\LIBNAME\android\build.gradle file.

    Fix version in dependency. Rebuild app. Test. Update.