Error Generating APK for Positivo Terminal Integration

I'm encountering an error while trying to generate the APK for integration with Stone. The app requires Positivo credentials to be installed on credit card terminals. However, when I attempt to generate the APK using the flutter run --flavor dev command, the following error occurs:

flutter run --flavor dev image2

Steps Followed: I followed the instructions in the link below as part of the setup process for integration with the Positivo terminal from Stone: Positivo: Build Process for Application on Debug Terminal

Observed Error: It seems that Flutter is unable to find the generated APK, or Gradle is failing to build the required APK. The error appears in the terminal as a failure in the Gradle build process.

build.gradle Configuration: I included the configuration snippet from the build.gradle file below, which has been modified to add the custom Positivo signing config as per the documentation. Here's the complete file with the settings I made. `

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: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply from: file('../positivo/positivo-signing-config.gradle')

android {
    compileSdkVersion 34
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        applicationId "dev.ltag.stone_payments_example"
        minSdkVersion 23
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    flavorDimensions "manufacturer"

    productFlavors {
        standard {
            dimension "manufacturer"
            signingConfig signingConfigs.positivo 
            isDefault true
        }
        dev {
            dimension "manufacturer"
            signingConfig signingConfigs.positivo
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
        positivo {
            initWith release
            signingConfig null
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

What I Have Tried:

I ran flutter clean and then tried again with flutter run --flavor dev. I checked the local.properties file to ensure the Flutter SDK is properly configured. Question: Can anyone help me identify what might be causing the APK generation failure, or if there is an issue with the Gradle configuration that is preventing installation on the Positivo terminal?

I ran flutter clean and then tried again with flutter run --flavor dev. I checked the local.properties file to ensure the Flutter SDK is properly configured. Question: Can anyone help me identify what might be causing the APK generation failure, or if there is an issue with the Gradle configuration that is preventing installation on the Positivo terminal?

Upvotes: 0

Views: 22

Answers (0)

Related Questions