Flutter/Android Push notification error

I am working on the push notification integration of my Flutter application and have been facing the following issue with the Android build of the app regarding a “PendingIntent” requiring a “FLAG_IMMUTABLE” argument.

I found the following support thread regarding a similar issue
https://support.backendless.com/t/push-notifications-causing-a-crash-when-targeting-android-api-31/14513/6 but the solution applied in the Backendless Android SDK 6.3.6 seems to have not worked for the template-based pushes from the Backendless console.

These looks to be the relevant lines in the Backendless Android SDK:


Since template-based pushing currently fails, is there a method through the Backendless console of sending push notifications that are not template based?

Backendless Version (3.x / 5.x, Online / Managed / Pro )


Client SDK (REST / Android / Objective-C / Swift / JS )

Backendless Flutter SDK: 7.2.7
Backendless Android SDK: 6.3.6

Application ID


Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. Send a push notification template from the Backendless Console
  2. Push notification is handled while mobile app is backgrounded

Actual Behavior

  1. Send a push notification template from the Backendless Console
  2. Push notification handler crashes with the following:

E/BackendlessFCMService( 3090): Error processing push notification
E/BackendlessFCMService( 3090): java.lang.IllegalArgumentException: us.boundlessdesign.customer_support_blue: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/BackendlessFCMService( 3090): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
E/BackendlessFCMService( 3090): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/BackendlessFCMService( 3090): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/BackendlessFCMService( 3090): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/BackendlessFCMService( 3090): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/BackendlessFCMService( 3090): at com.backendless.push.PushTemplateHelper.convertFromTemplate(PushTemplateHelper.java:267)
E/BackendlessFCMService( 3090): at com.backendless.push.BackendlessFCMService.handleMessageWithTemplate(BackendlessFCMService.java:134)
E/BackendlessFCMService( 3090): at com.backendless.push.BackendlessFCMService.handleMessage(BackendlessFCMService.java:102)
E/BackendlessFCMService( 3090): at com.backendless.push.BackendlessFCMService.onMessageReceived(BackendlessFCMService.java:68)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.FirebaseMessagingService.dispatchMessage(FirebaseMessagingService.java:235)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk(FirebaseMessagingService.java:185)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent(FirebaseMessagingService.java:172)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(FirebaseMessagingService.java:161)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.EnhancedIntentService.lambda$processIntent$0$EnhancedIntentService(EnhancedIntentService.java:78)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.-$$Lambda$EnhancedIntentService$NSk2h75eWhBOI4TsAFgvvtv1g9o.run(Unknown Source:6)

Hello @Mark_Moline

We were able to reproduce the issue, I have created an internal ticket BKNDLSS-30863 to fix it. The problem appears for the android SDK > 29 version.

Is there any workaround that I could implement for template-based push notifications in the meantime?

And if not, what do you think the timeline is on a published fix?

Thank you very much for looking into it!

hello @Mark_Moline

the workaround is to use android SDK <= 29. The fix is pretty complicated it will be available in 1-2 months

Gotcha. I believe the current Google store requirements are for new apps and updates to target at least SDK 31.

Looking forward to the update in 1-2 months.

Sorry for long delay. Fixed in 7.3.0 version of backendless_sdk for Flutter.

In trying to upgrade to the latest Flutter Backendless SDK in order to get the fix for the notification issue, I’m getting the following new error with Android gradle compilation:

C:\Users\xxx\AppData\Local\Pub\Cache\hosted\pub.dev\backendless_sdk-7.3.3\android\src\main\java\com\backendless\backendless_sdk\call_handlers\RtCallHandler.java:172: error: lambda expressions are not supported in -source 7
            new Handler(Looper.getMainLooper()).post(() -> methodChannel.invokeMethod("Backendless.RT." + method + ".EventResponse", arguments));
  (use -source 8 or higher to enable lambda expressions)
1 error

I’m upgrading from version 7.2.7 and the lambda expression that’s a part of that referenced line is new since 7.2.7.

In my app/build.gradle I specify the following in order to support java. 8 features as recommended in the Android documentation, but it doesn’t appear to be “working” and I’m struggling to find a solution:

android {
    compileSdkVersion flutter.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

    kotlinOptions {
        jvmTarget = '1.8'

I have yet to find any references to anyone else facing/fixing the same issue. Have you guys seen this or have any ideas on a potential solution?

Hello, @Mark_Moline.

This issue appears when your Java is older version that project requires.
You need to make sure that your project is actually using the correct version of Java. You indicated in the gradle that the project will use version 8, but your build may still be using the older one. Try updating dependencies and cleaning up the project.

Best Regards, Nikita.

Output from “flutter doctor -v” indicates that my Java version being used is 11, which is greater than 8. I believe that should be fine?

• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

I have updated everything that I know to update (latest version of flutter and all dependencies) and I have multiple times done a “flutter clean” and re-get of packages.

Can you follow this steps: Android Studio Error "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8" - Stack Overflow

I’m not super confident, but this looks fine to me. I had no issue with compilation of Backendless SDK versions up to 7.2.7.

$ ./gradlew --version

Gradle 6.7

Build time:   2020-10-14 16:13:12 UTC
Revision:     312ba9e0f4f8a02d01854d1ed743b79ed996dfd3

Kotlin:       1.3.72
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM:          15.0.2 (Oracle Corporation 15.0.2+7-27)
OS:           Linux 4.4.0-19041-Microsoft amd64

I have now tried to build my application and have gotten the same error about the lambda expression on my initial Windows machine and two additional MacOS machines, one of which had a clean install of everything.

Alright I was finally able to get compilation working again by moving to the latest Flutter-supported Gradle version and altering my gradle configurations until a build succeeded.

Thank you for the assistance and for the fixing of the original notification problem!

1 Like