flutter-stripe / flutter_stripe

Flutter SDK for Stripe.
https://pub.dev/packages/flutter_stripe
929 stars 514 forks source link

Issue building flutter app with 9.4.0 version of flutter_stripe #1426

Closed victorkennedys closed 11 months ago

victorkennedys commented 12 months ago

Describe the bug Hi! I am having a bug trying to build an appbundle.

I ran flutter clean && flutter build appbundle..

Before we had a different version of the package (flutter_stripe: ^3.2.0), but when I tried uploading an appbundle for production in play console I got the error that the package was outdated.

I keep getting errors. The one I am stuck on at the moment is:

Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script '/Users/victorkennedy/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1151

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/victorkennedy/Developer/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 35s

This is my pubspec.yaml (stripe packages at the end):

  cupertino_icons: ^1.0.2
  firebase_core: 2.1.1
  firebase_auth: ^4.1.1
  cloud_firestore: ^4.0.4
  google_fonts: ^2.2.0
  shared_preferences: ^2.0.12
  http: ^0.13.4
  image_picker: ^0.8.4
  firebase_storage: ^11.0.4
  readmore: ^2.1.0
  carousel_slider: ^4.0.0
  google_maps_flutter: ^2.1.1
  location: ^4.3.0
  google_place: ^0.4.7
  cached_network_image: ^3.2.0
  expandable_page_view: ^1.0.13
  firebase_messaging: ^14.0.4
  provider: ^6.0.2
  visibility_detector: ^0.3.3
  page_transition: ^2.0.5
  flutter_staggered_grid_view: ^0.6.1
  geocoding: ^2.1.0
  geolocator: ^9.0.1
  flutter_credit_card: ^3.0.1
  pay: ^1.0.8
  flutter_local_notifications: ^12.0.3
  permission_handler: 10.0.0 #7.2.0 for iOS
  flutter_cache_manager: ^3.3.0
  external_app_launcher: ^3.1.0
  flutter_rating_bar: ^4.0.0
  social_share: ^2.2.1
  store_checker: ^1.0.0
  lottie: ^1.3.0
  share_plus: ^4.0.4
  firebase_dynamic_links: ^5.0.4
  package_info_plus: ^1.4.2
  asset_cache: ^2.0.0
  flutter_web_frame: ^0.0.3 #WEB ONLY
  fluttertoast: ^8.0.9
  image_cropper: ^3.0.0
  shimmer: ^2.0.0
  simple_animations: ^4.1.0
  path_provider: ^2.0.11
  url_launcher: ^6.1.4
  app_links: ^3.2.0
  uuid: ^3.0.6
  pin_code_fields: ^7.4.0
  firebase_analytics: 10.0.4
  flutter_svg: ^1.1.3
  in_app_review: ^2.0.4
  facebook_app_events: ^0.18.1
  video_player: ^2.4.7
  dotted_border: ^2.0.0+2
  tuple: ^2.0.1
  sentry_flutter: ^6.13.1
  intercom_flutter: ^7.5.0
  rxdart: ^0.27.7
  crypto: ^3.0.2
  device_info_plus: ^8.0.0
  modal_bottom_sheet: ^2.1.2
  flutter_branch_sdk: ^6.6.0
  google_maps_flutter_web: ^0.4.0+3 #WEB ONLY
  firebase_instance_id: ^1.0.0 #WEB ONLY
  image_picker_for_web: ^2.1.10 #WEB ONLY
  instabug_flutter: ^11.6.0
  webview_flutter: ^2.0.3
  google_sign_in: ^5.4.3
  flutter_facebook_auth: ^5.0.7
  sign_in_with_apple: ^4.3.0
  webviewx: ^0.2.1
  shimmer_animation: ^2.1.0+1
  google_translator: ^1.0.0
  purchases_flutter: ^5.6.2
  flutter_stripe: ^9.4.0
  flutter_stripe_web: ^4.4.0

build.gradle (android folder level):

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

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

allprojects {
    repositories {
        google()
        mavenCentral()

        configurations.all{
            resolutionStrategy{
                force "com.google.android.gms:play-services-location:21.0.1"
            }
        }
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle (app level):

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: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('key.properties')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
   }

android {
    compileSdkVersion 33

     lintOptions {
        checkReleaseBuilds false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "se.woof.app"
        minSdkVersion 21
        targetSdkVersion 33
        versionCode 59
        versionName "2.0.8"
    }

    signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
   buildTypes {
       release {
           signingConfig signingConfigs.release
       }
   }
}

flutter {
    source '../..'
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:30.3.1')
    implementation 'com.google.firebase:firebase-auth'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

gradle-wrapper.properties:

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

I have also fixed the theme things stated in the package docs.

values-night/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.

         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="Theme.MaterialComponents">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

values/styles.xml :

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.

         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="Theme.MaterialComponents">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

I do not know what is wrong. I have been trying multiple ways to reproduce:

To Reproduce Steps to reproduce the behavior:

  1. Tried removing stripe web package
  2. Used: distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
  3. Used: ext.kotlin_version = '1.6.10'
remonh87 commented 12 months ago

I cannot reproduce it can you give me the verbose output of the build?