Release app crash

Hi,
Issue still there ,

Will it take too much time to fix ?
are we alone using Flutter SDK, the issue with the initialization of any flutter app using Backendless SDK

Is it ready for production ?

@mark-piller , kindly your feedback .

Hi @Mohamed_Rashed

This issue occured with Backendless.messaging.publish() call. It has nothing to do with initialization and account plans. I will check the sample project provided above and will give the feedback.

Best Regards,
Maksym

Hi @Mohamed_Elgendy

The issue you described is not related to Backendless SDK. If debug app is working fine and release crashes, it’s problem in release configuration.

I suppose the problem is, you don’t generate the apk with matching ABI.

I suggest to read about Android ABIs:

and how to create the release for each configuration.

Also you can try to install the release apk directly to the device by using command

flutter run --release -d {{deviceId}}

I suggest to run the application on real device, not emulators. There are a lot of issues assosiated with it.

And the last thing: I thnk this article may be useful for you:

I close the topic because the problem is no longer related to Flutter SDK.

Good luck in your endeavours!

Best Regards,
Maksym

1 Like

Hello …

I need to build a release APK if you please.

Please use the following command
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi

The APK works fine once I have removed the backendless from yaml then pub get.

Once I have re added it, it crashes.

Please fix.

What device do you run the application?
Also does you app work fine in release mode without backendless dependency?

Using Android 6, 7, 8, 8.1 and 9 … crashes.

Without backendless dependency … no crashes

Hi @Mohamed_Elgendy

I’ve just created the project from scratch, added backendless dependency, created release apk and successfully run it on my phone.
Can you specify the steps to reproduce or provide the sample project that reproduces your issue?
Also: does your app crashes with backendless dependency only in release mode or in debug too?

Best Regards,
Maksym

@Mohamed_Elgendy

Also try to update your flutter with

flutter upgrade

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

1 Like

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

2 Likes