stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.27k stars 265 forks source link

Build failed #600

Closed akshaykatale99 closed 2 years ago

akshaykatale99 commented 3 years ago

Describe the bug Build failed with error

FAILURE: Build failed with an exception.
* Where:
Build file '/Users/akshaykatale/wadpwoocom/bidcurios/node_modules/@stripe/stripe-react-native/android/build.gradle' line: 29

* What went wrong:
A problem occurred evaluating project ':stripe_stripe-react-native'.
> No signature of method: build_4e7eilkm9zrqfbtncxioqcpd6.android() is applicable for argument types: (build_4e7eilkm9zrqfbtncxioqcpd6$_run_closure1) values: [build_4e7eilkm9zrqfbtncxioqcpd6$_run_closure1@5c4c45e6]

Screenshots

Screenshot 2021-09-20 at 10 24 14 PM

Gradle 6.3 stripe-react-native ^0.2.2

pleopardi commented 3 years ago

I am having the exact same problem

arekkubaczkowski commented 3 years ago

@akshaykatale99 can you show me your build.gradle and app/build.gradle files?

arekkubaczkowski commented 3 years ago

please also make sure that your project conforms to the library requirements https://github.com/stripe/stripe-react-native#android

arekkubaczkowski commented 3 years ago

If above won't work, try to upgrade your app kotlin version to 1.5.10 or higher

akshaykatale99 commented 3 years ago

@akshaykatale99 can you show me your build.gradle and app/build.gradle files?

Hi @arekkubaczkowski ,

Here is my build.gradle and app/build.gradle

            // Top-level build file where you can add configuration options common to all sub-projects/modules.

            buildscript {
                ext {
                    buildToolsVersion = "29.0.2"
                    minSdkVersion = 21
                    compileSdkVersion = 29
                    targetSdkVersion = 30
                }
                repositories {
                    google()
                    jcenter()
                }
                dependencies {
                    classpath("com.android.tools.build:gradle:3.5.3")
                    classpath 'com.google.gms:google-services:4.3.3'
                    // NOTE: Do not place your application dependencies here; they belong
                    // in the individual module build.gradle files
                }
            }

            allprojects {
                repositories {
                    mavenLocal()
                    maven {
                        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                        url("$rootDir/../node_modules/react-native/android")
                    }
                    maven {
                        // Android JSC is installed from npm
                        url("$rootDir/../node_modules/jsc-android/dist")
                    }

                    google()
                    jcenter()
                    maven { url 'https://www.jitpack.io' }
                }
            }

            apply plugin: "com.android.application"
            apply plugin: 'com.google.gms.google-services'

            import com.android.build.OutputFile

            /**
             * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
             * and bundleReleaseJsAndAssets).
             * These basically call `react-native bundle` with the correct arguments during the Android build
             * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
             * bundle directly from the development server. Below you can see all the possible configurations
             * and their defaults. If you decide to add a configuration block, make sure to add it before the
             * `apply from: "../../node_modules/react-native/react.gradle"` line.
             *
             * project.ext.react = [
             *   // the name of the generated asset file containing your JS bundle
             *   bundleAssetName: "index.android.bundle",
             *
             *   // the entry file for bundle generation. If none specified and
             *   // "index.android.js" exists, it will be used. Otherwise "index.js" is
             *   // default. Can be overridden with ENTRY_FILE environment variable.
             *   entryFile: "index.android.js",
             *
             *   // https://reactnative.dev/docs/performance#enable-the-ram-format
             *   bundleCommand: "ram-bundle",
             *
             *   // whether to bundle JS and assets in debug mode
             *   bundleInDebug: false,
             *
             *   // whether to bundle JS and assets in release mode
             *   bundleInRelease: true,
             *
             *   // whether to bundle JS and assets in another build variant (if configured).
             *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
             *   // The configuration property can be in the following formats
             *   //         'bundleIn${productFlavor}${buildType}'
             *   //         'bundleIn${buildType}'
             *   // bundleInFreeDebug: true,
             *   // bundleInPaidRelease: true,
             *   // bundleInBeta: true,
             *
             *   // whether to disable dev mode in custom build variants (by default only disabled in release)
             *   // for example: to disable dev mode in the staging build type (if configured)
             *   devDisabledInStaging: true,
             *   // The configuration property can be in the following formats
             *   //         'devDisabledIn${productFlavor}${buildType}'
             *   //         'devDisabledIn${buildType}'
             *
             *   // the root of your project, i.e. where "package.json" lives
             *   root: "../../",
             *
             *   // where to put the JS bundle asset in debug mode
             *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
             *
             *   // where to put the JS bundle asset in release mode
             *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
             *
             *   // where to put drawable resources / React Native assets, e.g. the ones you use via
             *   // require('./image.png')), in debug mode
             *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
             *
             *   // where to put drawable resources / React Native assets, e.g. the ones you use via
             *   // require('./image.png')), in release mode
             *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
             *
             *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
             *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
             *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
             *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
             *   // for example, you might want to remove it from here.
             *   inputExcludes: ["android/**", "ios/**"],
             *
             *   // override which node gets called and with what additional arguments
             *   nodeExecutableAndArgs: ["node"],
             *
             *   // supply additional arguments to the packager
             *   extraPackagerArgs: []
             * ]
             */

            project.ext.react = [
                enableHermes: false
            ]

            apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
            apply from: "../../node_modules/react-native/react.gradle"
            apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"

            /**
             * Set this to true to create two separate APKs instead of one:
             *   - An APK that only works on ARM devices
             *   - An APK that only works on x86 devices
             * The advantage is the size of the APK is reduced by about 4MB.
             * Upload all the APKs to the Play Store and people will download
             * the correct one based on the CPU architecture of their device.
             */
            def enableSeparateBuildPerCPUArchitecture = false

            /**
             * Run Proguard to shrink the Java bytecode in release builds.
             */
            def enableProguardInReleaseBuilds = false

            /**
             * The preferred build flavor of JavaScriptCore.
             *
             * For example, to use the international variant, you can use:
             * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
             *
             * The international variant includes ICU i18n library and necessary data
             * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
             * give correct results when using with locales other than en-US.  Note that
             * this variant is about 6MiB larger per architecture than default.
             */
            def jscFlavor = 'org.webkit:android-jsc:+'

            /**
             * Whether to enable the Hermes VM.
             *
             * This should be set on project.ext.react and mirrored here.  If it is not set
             * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
             * and the benefits of using Hermes will therefore be sharply reduced.
             */
            def enableHermes = project.ext.react.get("enableHermes", false);

            android {
                compileSdkVersion rootProject.ext.compileSdkVersion

                compileOptions {
                    sourceCompatibility JavaVersion.VERSION_1_8
                    targetCompatibility JavaVersion.VERSION_1_8
                }

                defaultConfig {
                    applicationId "com.wadp.bidcurios"
                    minSdkVersion rootProject.ext.minSdkVersion
                    targetSdkVersion rootProject.ext.targetSdkVersion
                    versionCode 10
                    versionName "1.3.0"
                }
                splits {
                    abi {
                        reset()
                        enable enableSeparateBuildPerCPUArchitecture
                        universalApk false  // If true, also generate a universal APK
                        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
                    }
                }
                signingConfigs {
                    debug {
                        storeFile file('debug.keystore')
                        storePassword 'android'
                        keyAlias 'androiddebugkey'
                        keyPassword 'android'
                    }

                    release {
                        if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                            storeFile file(MYAPP_UPLOAD_STORE_FILE)
                            storePassword MYAPP_UPLOAD_STORE_PASSWORD
                            keyAlias MYAPP_UPLOAD_KEY_ALIAS
                            keyPassword MYAPP_UPLOAD_KEY_PASSWORD
                        }
                    }
                }
                buildTypes {
                    debug {
                        signingConfig signingConfigs.debug
                    }
                    release {
                        // Caution! In production, you need to generate your own keystore file.
                        // see https://reactnative.dev/docs/signed-apk-android.
                        signingConfig signingConfigs.release
                        minifyEnabled enableProguardInReleaseBuilds
                        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
                    }
                }

                // applicationVariants are e.g. debug, release
                applicationVariants.all { variant ->
                    variant.outputs.each { output ->
                        // For each separate APK per architecture, set a unique version code as described here:
                        // https://developer.android.com/studio/build/configure-apk-splits.html
                        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
                        def abi = output.getFilter(OutputFile.ABI)
                        if (abi != null) {  // null for the universal-debug, universal-release variants
                            output.versionCodeOverride =
                                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
                        }

                    }
                }
            }

            dependencies {
                implementation fileTree(dir: "libs", include: ["*.jar"])
                //noinspection GradleDynamicVersion
                implementation "com.facebook.react:react-native:+"  // From node_modules
                implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
                implementation project(':lottie-react-native')
                debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
                  exclude group:'com.facebook.fbjni'
                }
                debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
                    exclude group:'com.facebook.flipper'
                    exclude group:'com.squareup.okhttp3', module:'okhttp'
                }
                debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
                    exclude group:'com.facebook.flipper'
                }
                addUnimodulesDependencies()

                if (enableHermes) {
                    def hermesPath = "../../node_modules/hermes-engine/android/";
                    debugImplementation files(hermesPath + "hermes-debug.aar")
                    releaseImplementation files(hermesPath + "hermes-release.aar")
                } else {
                    implementation jscFlavor
                }
            }

            // Run this once to be able to run the application with BUCK
            // puts all compile dependencies into folder libs for BUCK to use
            task copyDownloadableDepsToLibs(type: Copy) {
                from configurations.compile
                into 'libs'
            }

            apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
arekkubaczkowski commented 3 years ago

@akshaykatale99 as I mentioned above, please try to update kotlin version

charliecruzan-stripe commented 2 years ago

@akshaykatale99 are you still having this issue after updating your kotlin version?

muja555 commented 2 years ago

I have the same issue, I have no Kotlin in my project Here is my build.gradle and app/build.gradle

here's my build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "20.1.5948944"
        androidXCore = "1.7.0"
    }
    repositories {
        google()
        jcenter()
        mavenLocal()
        mavenCentral()
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.9, 0.99.99]'

    }

}

allprojects {
    repositories {
        mavenLocal()
        maven { url 'https://sdk.smartlook.com/android/release' }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven {
            url "$rootDir/../node_modules/detox/Detox-android"
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

here's my app/build.gradle

apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services' // <- Add this line
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

import com.android.build.OutputFile

project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

def jscFlavor = 'org.webkit:android-jsc:+'

def enableHermes = project.ext.react.get("enableHermes", false);

ext.vMajor = 3
ext.vMinor = "1"
ext.vMinor2 = "7"

def computeVersionName() {
    return String.format('%d.%s.%s', vMajor, vMinor, vMinor2)
}

def computeVersionCode(BUILD_NUMBER) {
    return Integer.valueOf(String.format('%d%s%s%d', vMajor, vMinor, vMinor2, Integer.valueOf(BUILD_NUMBER ?: 111) + 200))
}

android {
    ndkVersion rootProject.ext.ndkVersion
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.deelzat"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        compileSdkVersion rootProject.ext.compileSdkVersion
        compileSdk rootProject.ext.compileSdkVersion
        minCompileSdk rootProject.ext.compileSdkVersion
        versionName computeVersionName()
        if (System.getenv("AC_APPCIRCLE")) {
            def buildNumber = System.getenv("AC_BUILD_NUMBER")
            versionCode = computeVersionCode(buildNumber)
        } else {
            versionCode 2500
        }
        multiDexEnabled true
        missingDimensionStrategy 'react-native-camera', 'general'
        manifestPlaceholders = [auth0Domain: "deelzat.eu.auth0.com", auth0Scheme: "com.deelzat"]
        testBuildType System.getProperty('testBuildType', 'debug')  // This will later be used to control the test apk build type
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        releaseSigningConfig {
            storeFile rootProject.file("app/testapp.jks")
            storePassword System.getProperty("APPCENTER_KEYSTORE_PASSWORD")
            keyAlias System.getProperty("APPCENTER_KEY_ALIAS")
            keyPassword System.getProperty("APPCENTER_KEY_PASSWORD")
        }
        release {
             if (System.getenv('AC_APPCIRCLE')) { // new configuration for Appcircle
                 println 'Running on Appcircle'
                 keyAlias "${System.getenv("AC_ANDROID_ALIAS")}"
                 keyPassword "${System.getenv("AC_ANDROID_ALIAS_PASSWORD")}"
                 storeFile file("${System.getenv("AC_ANDROID_KEYSTORE_PATH")}")
                 storePassword "${System.getenv("AC_ANDROID_KEYSTORE_PASSWORD")}"
             } else {
               storeFile file('debug.keystore')
               storePassword 'android'
               keyAlias 'androiddebugkey'
               keyPassword 'android'
             }
              v2SigningEnabled true
              v1SigningEnabled true
           }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
        //     // Caution! In production, you need to generate your own keystore file.
        //     // see https://reactnative.dev/docs/signed-apk-android.
        //     signingConfig signingConfigs.debug
           signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])

    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.android.support:multidex:1.0.3'

    implementation project(':react-native-blurhash')

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    implementation("com.squareup.okhttp3:okhttp-urlconnection:4.4.1")

    implementation project(':react-native-fbsdk-next')
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.annotation:annotation:1.0.2'
    androidTestImplementation('com.wix:detox:+')
//
//     debugImplementation('com.facebook.flipper:flipper:0.113.0') {
//             exclude group:'com.facebook.fbjni'
//     }
//     debugImplementation('com.facebook.flipper:flipper-network-plugin:0.113.0') {
//             exclude group:'com.facebook.flipper'
//     }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
muja555 commented 2 years ago

This helped me to get it work: https://exerror.com/the-mincompilesdk-31-specified-in-a-dependencys-aar-metadata-is-greater-than-this-modules-compilesdkversion/

charliecruzan-stripe commented 2 years ago

I have no Kotlin in my project

You likely have kotlin in some dependencies. I suggest trying the solutions @muja555 posted

charliecruzan-stripe commented 2 years ago

Closing this since it seems the fix is to update your kotlin version (the error you shared @muja555 is a different one altogether). If you're running into this, please open a new issue and share your build.gradle file

LongDuong96 commented 2 years ago

I have the same issue, I have no Kotlin in my project Here is my build.gradle and app/build.gradle

here's my build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "20.1.5948944"
        androidXCore = "1.7.0"
    }
    repositories {
        google()
        jcenter()
        mavenLocal()
        mavenCentral()
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.9, 0.99.99]'

    }

}

allprojects {
    repositories {
        mavenLocal()
        maven { url 'https://sdk.smartlook.com/android/release' }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven {
            url "$rootDir/../node_modules/detox/Detox-android"
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

here's my app/build.gradle

apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services' // <- Add this line
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

import com.android.build.OutputFile

project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

def jscFlavor = 'org.webkit:android-jsc:+'

def enableHermes = project.ext.react.get("enableHermes", false);

ext.vMajor = 3
ext.vMinor = "1"
ext.vMinor2 = "7"

def computeVersionName() {
    return String.format('%d.%s.%s', vMajor, vMinor, vMinor2)
}

def computeVersionCode(BUILD_NUMBER) {
    return Integer.valueOf(String.format('%d%s%s%d', vMajor, vMinor, vMinor2, Integer.valueOf(BUILD_NUMBER ?: 111) + 200))
}

android {
    ndkVersion rootProject.ext.ndkVersion
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.deelzat"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        compileSdkVersion rootProject.ext.compileSdkVersion
        compileSdk rootProject.ext.compileSdkVersion
        minCompileSdk rootProject.ext.compileSdkVersion
        versionName computeVersionName()
        if (System.getenv("AC_APPCIRCLE")) {
            def buildNumber = System.getenv("AC_BUILD_NUMBER")
            versionCode = computeVersionCode(buildNumber)
        } else {
            versionCode 2500
        }
        multiDexEnabled true
        missingDimensionStrategy 'react-native-camera', 'general'
        manifestPlaceholders = [auth0Domain: "deelzat.eu.auth0.com", auth0Scheme: "com.deelzat"]
        testBuildType System.getProperty('testBuildType', 'debug')  // This will later be used to control the test apk build type
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        releaseSigningConfig {
            storeFile rootProject.file("app/testapp.jks")
            storePassword System.getProperty("APPCENTER_KEYSTORE_PASSWORD")
            keyAlias System.getProperty("APPCENTER_KEY_ALIAS")
            keyPassword System.getProperty("APPCENTER_KEY_PASSWORD")
        }
        release {
             if (System.getenv('AC_APPCIRCLE')) { // new configuration for Appcircle
                 println 'Running on Appcircle'
                 keyAlias "${System.getenv("AC_ANDROID_ALIAS")}"
                 keyPassword "${System.getenv("AC_ANDROID_ALIAS_PASSWORD")}"
                 storeFile file("${System.getenv("AC_ANDROID_KEYSTORE_PATH")}")
                 storePassword "${System.getenv("AC_ANDROID_KEYSTORE_PASSWORD")}"
             } else {
               storeFile file('debug.keystore')
               storePassword 'android'
               keyAlias 'androiddebugkey'
               keyPassword 'android'
             }
              v2SigningEnabled true
              v1SigningEnabled true
           }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
        //     // Caution! In production, you need to generate your own keystore file.
        //     // see https://reactnative.dev/docs/signed-apk-android.
        //     signingConfig signingConfigs.debug
           signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])

    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.android.support:multidex:1.0.3'

    implementation project(':react-native-blurhash')

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    implementation("com.squareup.okhttp3:okhttp-urlconnection:4.4.1")

    implementation project(':react-native-fbsdk-next')
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.annotation:annotation:1.0.2'
    androidTestImplementation('com.wix:detox:+')
//
//     debugImplementation('com.facebook.flipper:flipper:0.113.0') {
//             exclude group:'com.facebook.fbjni'
//     }
//     debugImplementation('com.facebook.flipper:flipper-network-plugin:0.113.0') {
//             exclude group:'com.facebook.flipper'
//     }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

Update build:gradle to classpath("com.android.tools.build:gradle:4.2.2")