Release app crash

Hi @Mohamed_Rashed, @Mohamed_Elgendy and @Andrew_Gadri-Akrong

The release application crash was caused by the Android code optimizer (ProGuard or R8). The Flutter enables the optimization and obfuscation by default.
There are two ways to solve this problem: disable optimizer or configure the optimizer config to don’t delete the necessary files.

  1. To disable the optimizer you can simply add the option minifyEnabled false to your android/app/build.gradle:

    android {
        buildTypes {
            release {
                ...
                minifyEnabled false
            }
        }
    }
    
  2. If you don’t want to disable the optimizer, you should add the following lines to your proguard config, due to the documentation:

    -dontwarn com.backendless.**
    -dontwarn weborb.**
    -keep class weborb.** {;}
    -keep class com.backendless.** {
    ;}

Don’t forget to specify the proguard config in your android/app/build.gradle file:

android {
    buildTypes {
        release {
            ...
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Both methods work fine for me. Hope this instruction will help you.

Also don’t forget to add Internet permission to your release app. You should include

<uses-permission android:name="android.permission.INTERNET" />

in your android/app/src/main/AndroidManifest.xml file.

If you have any difficulties with building and releasing an Android app, please visit the official Flutter documentation: Build and release an Android app

Best Regards,
Maksym

2 Likes