androidflutterflutter-stripe

flutter_stripe Build failed with an exception on android


I am using the flutter_stripe plugin for stripe payment. It is working on IOS but on android, I am getting this error . As per flutter_stripe documentation all settings done for android and ios..

FAILURE: Build failed with an exception.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not resolve com.stripe:stripe-android:20.1.+. Required by: project :app > project :stripe_android > Failed to list versions for com.stripe:stripe-android. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml. > Could not get resource 'https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml'. > Could not GET 'https://google.bintray.com/exoplayer/com/stripe/stripe-android/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

BUILD FAILED in 6m 3s [!] Gradle threw an error while downloading artifacts from the network. Retrying to download...

android/build.gradle

buildscript {
ext.kotlin_version = '1.6.10'
repositories {

    google()
   // mavenCentral()
    jcenter()


}

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

}

}

allprojects {
repositories {

    google()
    jcenter()
    //mavenCentral()
}

}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
    project.evaluationDependsOn(':app')
}

Tried jcenter() and mavenCentral().but getting same error


Solution

  • I forked and fixed it.

    1. Fork flutter_stripe

    2. Replace com.stripe:stripe-android** (flutter_stripe/packages/stripe_android/android/build.gradle)

      Add stripe-android to your build.gradle dependencies.

      dependencies {
          implementation 'com.stripe:stripe-android:20.4.0'
      }
      

      reference

    3. Replace flutter_android with the repository you forked flutter_stripe/packages/stripe/pubspec.yaml

      Like this

       dependencies:
         flutter:
           sdk: flutter
         stripe_android:
           git:
             url: https://github.com/<YourName>/flutter_stripe.git
             ref: <Branch Name>
             path: packages/stripe_android
      

      My Repository