wonderpush / wonderpush-flutter-sdk

Flutter SDK for WonderPush − Advanced push notification service for mobile applications and Websites. High volume, fast delivery and full-featured starting €1/month.
https://pub.dev/documentation/wonderpush_flutter/
Apache License 2.0
4 stars 0 forks source link

WonderPush not working with product flavors, when using applicationIdSuffix #5

Open ThiemoImgraben opened 2 months ago

ThiemoImgraben commented 2 months ago

I have integrated the SDK as in the documentation, but WonderPush gets not initialized. This only happens on Android, Ios is working fine.

D/WonderPushPlugin(14266): onMethodCall [subscribeToNotifications]
E/WonderPush(14266): Cannot call WonderPush.subscribeToNotifications before initialization. Please call WonderPush.initialize() first.
E/WonderPush(14266): com.wonderpush.sdk.WonderPushNotInitializedImpl$WonderPushNotInitializedException: Cannot call WonderPush.subscribeToNotifications before initialization. Please call WonderPush.initialize() first.
ThiemoImgraben commented 2 months ago

After some research, I found out that the root of the issue is the android product flavor setup. Specifically the applicationIdSuffix is causing the issue. When not using the suffix, everything is working as expected.

 productFlavors {
        develop {
            dimension "stage"
            applicationIdSuffix ".dev"
            resValue "string", "app_name", "IDev"
        }
}
ofavre commented 1 month ago

Can you check if this section of our documentation helps? https://docs.wonderpush.com/docs/android-sdk#specifying-where-to-find-the-buildconfig-class

I think the BuildConfig class is not found. You likely have related log during your application startup.