skip to Main Content

I am facing a problem, when I run into teminal flutter build appbundle –release this error occurs 🙁
Is there any good angel who can help me?

FAILURE: Build failed with an exception.
Execution failed for task ‘:app:minifyReleaseWithR8’.
A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
Compilation failed to complete, origin: C:users_freschissimo_appbuildflutter_geofireintermediatesruntime_library_classes_jarreleaseclasses.jar:com/example/users_freschissimo_
app/BuildConfig.class

appbuild.gradle

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 plugin: 'com.google.gms.google-services'


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

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'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.freschissimo.usersapp"
        minSdkVersion 27
        targetSdkVersion 33
        versionCode 12 //change it for release
        versionName "1.0" //change it for release
        multiDexEnabled true
    }

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

    namespace "com.example.users_freschissimo_app"
}

flutter {
    source '../..'
}

dependencies {
    implementation 'com.facebook.android:facebook-android-sdk:5.15.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "com.android.support:multidex:1.0.1"
    implementation 'com.stripe:stripe-android:17.1.1'
    implementation platform('com.google.firebase:firebase-bom:31.2.0')
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-appcheck-debug:16.0.0-beta01'
    implementation 'com.google.android.play:integrity:1.3.0'
}

androidbuild.gradle

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

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

2

Answers


  1. Chosen as BEST ANSWER

    Solution: I had mistakenly changed the package of the within the AndroidManifest of the local flutter_geofire plugin. Change the package to that of the AndroidManifest file within the git repository of the FLUTTER GEOFIRE plugin


  2. If you don’t have this problem with debug builds, you can disable R8 for debug builds by inserting the following line to your gradle.properties file:

    android.enableR8 = false

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search