4

I am getting following error while trying to build Android app in Flutter project

What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.stripe:stripe-android:20.4.1.
     Required by:
         project :app > project :stripe_android
      > Could not resolve com.stripe:stripe-android:20.4.1.
         > Could not get resource 'https://google.bintray.com/exoplayer/com/stripe/stripe-android/20.4.1/stripe-android-20.4.1.pom'.
            > Could not GET 'https://google.bintray.com/exoplayer/com/stripe/stripe-android/20.4.1/stripe-android-20.4.1.pom'. Received status code 502 from server: Bad Gateway
   > Could not resolve com.stripe:financial-connections:20.4.1.
     Required by:
         project :app > project :stripe_android
      > Could not resolve com.stripe:financial-connections:20.4.1.
         > Could not get resource 'https://google.bintray.com/exoplayer/com/stripe/financial-connections/20.4.1/financial-connections-20.4.1.pom'.
            > Could not GET 'https://google.bintray.com/exoplayer/com/stripe/financial-connections/20.4.1/financial-connections-20.4.1.pom'. Received status code 502 from server: Bad Gateway

pubspec.yaml file

flutter_stripe:

android/build.gradle file

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

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.1'
        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
}

I think the problem is related to jcentre() but not using jcentre() in my app or stripe is also not using it but still I am getting the error.

Build just retries again and again but always the same error.

tried this thread but no luck

Rafid Kotta
  • 740
  • 1
  • 7
  • 18
  • Looking at the other thread you referenced, and based on that it does seem like the concern may be the unpinned versions being used here: https://github.com/flutter-stripe/flutter_stripe/blob/main/packages/stripe_android/android/build.gradle. I would recommend raising this as an issue in that repo so the devs can help troubleshoot or determine if your environment is missing an expected configuration. – toby Jun 29 '22 at 15:11
  • 3
    did you ever resolve this ? we are seeing same issue – ajonno Oct 31 '22 at 07:30
  • same issue with me – AHMAD_AR Oct 31 '22 at 07:36
  • Did anyone find solution, was working fine yesterday but getting same issue today – Harish Sharma Oct 31 '22 at 07:59

2 Answers2

0

I managed to get through it by manipulating the second or third-section of the versions in the error which could not be resolved.

  • In the project files, scroll down to External Libraries then Flutter Plugins.
  • find your strip_android-'your version' then android/build.gradle
  • Scroll down to the dependencies section then find packages ending with + in there version. (Mostly the one in the error log).
  • Remove the + and try setting it to 0 or decrease the second version number by one but make sure to remove the +.

In Flutter_stripe: 5.0.0 my error was 20.9.+ then convert it to 20.9.0 and it worked.

In Flutter_stripe: 6.0.0 my error was 20.12.+ then convert it to 20.11.0 and it worked while 20.12.0 did not work.

-1

I had the same problem, I solved it by simply upgrading the version of gradel.
I added classpath 'com.android.tools.build:gradle:7.1.2' to build.gradle at the project level and I added distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip to gradle.wrapper.properties.