Support Topics Documentation Slack YouTube Blog

Release app crash

Hi Mohamed,

Were you able to resolve the problem?

Regards,
Mark

I have the same problem where when I include the backendless dependancy(1.0.0, 1.0.1,1.1.2) and release apk it crashes on start up. After reading this thread I did flutter upgrade and the release apk is still crashing. It works fine on the emulator tho.

Here’s where I do Backendless.initApp

Help please

Hi @Andrew_Gadri-Akrong

As I understand, the app crushes only on real device and works fine on emulator?

Exactly

@Andrew_Gadri-Akrong , what version of Android does the device run?

Can you also provide the code that causes the app to crash? Is it Backendless initialization or any other operation?

Regards,
Maksym

Android version 7.0

Just backendless initialization.
Initially, I did the backendless initialization, sign up, login and logout using the documentation. It run fine on the emulator but crashes on release apk running on real device. I started debugging by commenting out the sign up, login and logout leaving the initialization. Worked on emulator and I did a release apk and run on a real device and still crashed.

Hi Andrew, could you please confirm that the crash occurs only when the Backendless dependency is added? Have you confirmed that without the dependency it runs fine?

Without the dependancy is runs fine

Hi @Mohamed_Rashed @Mohamed_Elgendy and @Andrew_Gadri-Akrong

I can reproduce the issue with release app crashing. I’ve created the internal ticket BKNDLSS-20713. Will update you with a progress.

Best Regards,
Maksym

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

1 Like