OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
623 stars 213 forks source link

[Bug]: Cannot subscribe in Release mode on Huawei devices #956

Closed tommylung closed 2 weeks ago

tommylung commented 1 month ago

What happened?

I have the same code and settings on Huawei devices. It can subscribe in Debug Mode, but it does not work in Release Mode.

Red Box is Debug Mode, and Blue Box is Release Mode. Screenshot 2024-09-26 at 2 12 22 PM

Steps to reproduce?

1. Using SDK v5.2.5
2. Can subscribe in Debug Mode. Cannot subscribe in Release Mode.

What did you expect to happen?

I expected to subscribe to OneSignal with Debug mode and Release mode on Huawei devices.

OneSignal Flutter SDK version

Release 5.2.5

Which platform(s) are affected?

Relevant log output

No response

Code of Conduct

tommylung commented 2 weeks ago

It was successful to subscribe in Release mode after updating the proguard rules in app/build.gradle.

Change

buildTypes {
    debug {
        signingConfig signingConfigs.release
    }
    release {
        signingConfig signingConfigs.release
    }
}

to

buildTypes {
    debug {
        signingConfig signingConfigs.release
    }
    release {
        shrinkResources false
        minifyEnabled false
        signingConfig signingConfigs.release
    }
}

Reference: https://stackoverflow.com/questions/65872226/missingpluginexception-in-flutter-in-release-mode-android