ionic-team / capacitor-plugins

Official plugins for Capacitor โšก๏ธ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

capacitor/push-notifications won't build on Android

JackLazenbyZigzag opened this issue ยท comments

Bug Report

Plugin(s)

@capacitor/push-notifications version 5.1.1

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 5.7.1
  @capacitor/core: 5.7.1
  @capacitor/android: 5.7.1
  @capacitor/ios: 5.7.1

Installed Dependencies:

  @capacitor/cli: 5.7.0
  @capacitor/android: 5.7.0
  @capacitor/core: 5.7.0
  @capacitor/ios: 5.7.0

[success] iOS looking great! ๐Ÿ‘Œ
[success] Android looking great! ๐Ÿ‘Œ

Platform(s)

Android

Current Behavior

When building the app on Android using the latest version of Android Studio (and the latest gradle version) the push notification plugin is giving me this error:

error: no suitable method found for createNotificationInfo(Context,Context,NotificationParams,String,Bundle) CommonNotificationBuilder.DisplayNotificationInfo notificationInfo = CommonNotificationBuilder.createNotificationInfo( ^ method CommonNotificationBuilder.createNotificationInfo(Context,NotificationParams) is not applicable (actual and formal argument lists differ in length) method CommonNotificationBuilder.createNotificationInfo(Context,String,NotificationParams,String,Resources,PackageManager,Bundle) is not applicable (actual and formal argument lists differ in length)

Expected Behavior

The plugin builds as expected.

Code Reproduction

Create an application with the following capacitor plugins:

"@capacitor/app": "5.0.7",
        "@capacitor/camera": "^5.0.8",
        "@capacitor/core": "5.7.0",
        "@capacitor/device": "^5.0.6",
        "@capacitor/haptics": "5.0.7",
        "@capacitor/network": "^5.0.6",
        "@capacitor/preferences": "^5.0.6",
        "@capacitor/push-notifications": "^5.1.1",
        "@capacitor/share": "^5.0.7",
        "@capacitor/status-bar": "5.0.7",
        "@capacitor/android": "^5.7.0",
        "@capacitor/cli": "5.7.0",
        "@capacitor/ios": "^5.7.0",

sync up and build as per, then try to run on an Android emulator.

Other Technical Details

The code giving the error is in PushNotificationsPlugin.java, specifically:

CommonNotificationBuilder.DisplayNotificationInfo notificationInfo = CommonNotificationBuilder.createNotificationInfo(
                            getContext(),
                            getContext(),
                            params,
                            channelId,
                            bundle
                        );

Additional Context

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.