Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: Execution failed for task ':app:minifyReleaseWithR8'

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_app\build\flutter_geofire\intermediates\runtime_library_classes_jar\release\classes.jar:com/example/users_freschissimo_ app/BuildConfig.class

app\build.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'
}

android\build.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
}
like image 261
Simone Avatar asked Feb 02 '26 01:02

Simone


1 Answers

Go to app level build.gradle and

add these two lines in the android/buildTypes/release block like this

android {
   // Other code
    buildTypes {
        release {
            // add the following two lines
            minifyEnabled false
            shrinkResources false
        }
    }
}
like image 134
Munsif Ali Avatar answered Feb 03 '26 16:02

Munsif Ali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!