square / in-app-payments-flutter-plugin

Flutter Plugin for Square In-App Payments SDK
https://developer.squareup.com/docs
Apache License 2.0
339 stars 121 forks source link

Can't build to Android #209

Closed mdeandrea-mrmilu closed 1 year ago

mdeandrea-mrmilu commented 1 year ago

Describe the issue

I tried build a app to Android and get this error

Here is the log:

* What went wrong:
Execution failed for task ':app:checkBetaDebugAarMetadata'.
> Could not resolve all files for configuration ':app:betaDebugRuntimeClasspath'.
   > Failed to transform card-entry-1.5.6.aar (com.squareup.sdk.in-app-payments:card-entry:1.5.6) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Could not download card-entry-1.5.6.aar (com.squareup.sdk.in-app-payments:card-entry:1.5.6)
         > Could not get resource 'https://sdk.squareup.com/public/android/com/squareup/sdk/in-app-payments/card-entry/1.5.6/card-entry-1.5.6.aar'.
            > Could not GET 'https://sdk.squareup.com/public/android/com/squareup/sdk/in-app-payments/card-entry/1.5.6/card-entry-1.5.6.aar'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.1.1/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Failed to transform google-pay-1.5.6.aar (com.squareup.sdk.in-app-payments:google-pay:1.5.6) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Could not download google-pay-1.5.6.aar (com.squareup.sdk.in-app-payments:google-pay:1.5.6)
         > Could not get resource 'https://sdk.squareup.com/public/android/com/squareup/sdk/in-app-payments/google-pay/1.5.6/google-pay-1.5.6.aar'.
            > Could not GET 'https://sdk.squareup.com/public/android/com/squareup/sdk/in-app-payments/google-pay/1.5.6/google-pay-1.5.6.aar'.

To Reproduce

Steps to reproduce the issue.

  1. Build to Android

Expected behavior

That can build to Android

Environment

[✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-x64, locale en-ES) • Flutter version 3.3.10 on channel stable at /Users/matias/fvm/versions/3.3.10 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 135454af32 (5 weeks ago), 2022-12-15 07:36:55 -0800 • Engine revision 3316dd8728 • Dart version 2.18.6 • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) • Android SDK at /Users/matias/Library/Android/sdk • Platform android-33, build-tools 33.0.1 • ANDROID_HOME = /Users/matias/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted.

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

[✓] Android Studio (version 2021.3) • 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.13+0-b1751.21-8125866)

[✓] VS Code (version 1.74.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.56.0

[✓] Connected device (1 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)

[✓] HTTP Host Availability • All required HTTP hosts are available

Screenshots

Additional context

app/build.gradle

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

build.gradle

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

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

ext {
    sqipVersion = '1.5.6'
}

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

gradle.properties

org.gradle.jvmargs=-Xmx1536M
android.jetifier.ignorelist=moshi-1.13.0
android.jetifier.blacklist=moshi-1.13.0
android.useAndroidX=true
android.enableJetifier=true
android.proguard.enableRulesExtraction=false # I tried with this to true too

gradle-wrapper.properties

#Tue Feb 12 17:25:27 PST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
mdeandrea-mrmilu commented 1 year ago

Related issues:

jannisnikoy commented 1 year ago

Suddenly stopped working for me this morning too, without any changes to our repository. Oddly enough, I can build it locally just fine, but when running the exact same command through CodeMagic; it fails miserably.

mdeandrea-mrmilu commented 1 year ago

Solved! I had 3 projects. 1 shared and 2 apps. 1 of these apps don't use square_in_app_payments, so when I import the shared project with square_in_app_payments dependency I have got this error.

I removing dependency from shared project and now the projects works fine