Unity-Technologies / NotificationsSamples

Sample project for Unity Notifications
Other
283 stars 50 forks source link

java.lang.NoSuchMethodError: no static method with name='getNotificationManagerImpl' Unirty version 2021.1.15f1 #67

Closed Indrit-Vaka closed 3 years ago

Indrit-Vaka commented 3 years ago

I am using unity 2021.1.15f1

Fixed by disabling minify image

And I got an error and it can't send a notification... I fixed this problem in older versions of unity by modifying proguard file, ( https://github.com/Unity-Technologies/NotificationsSamples/issues/62 ) but now the location of proguard files has changed and

Here is a full list of error

2021/07/17 20:31:59.789 31975 32024 Error Unity AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='getNotificationManagerImpl' signature='(Landroid.app.Application;Lcom.unity3d.player.UnityPlayerActivity;)Ljava/lang/Object;' in class Lcom.unity.androidnotifications.UnityNotificationManager;

2021/07/17 20:31:59.789 31975 32024 Error Unity java.lang.NoSuchMethodError: no static method with name='getNotificationManagerImpl' signature='(Landroid.app.Application;Lcom.unity3d.player.UnityPlayerActivity;)Ljava/lang/Object;' in class Lcom.unity.androidnotifications.UnityNotificationManager;

2021/07/17 20:31:59.789 31975 32024 Error Unity at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source) 2021/07/17 20:31:59.789 31975 32024 Error Unity at com.unity3d.player.UnityPlayer.nativeRender(Native Method) 2021/07/17 20:31:59.789 31975 32024 Error Unity at com.unity3d.player.UnityPlayer.access$300(Unknown Source) 2021/07/17 20:31:59.789 31975 32024 Error Unity at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source) 2021/07/17 20:31:59.789 31975 32024 Error Unity at android.os.Handler.dispatchMessage(Handler.java:98) 2021/07/17 20:31:59.789 31975 32024 Error Unity at android.os.Looper.loop(Looper.java:154) 2021/07/17 20:31:59.789 31975 32024 Error Unity at com.unity3d.player.UnityPlayer$e.run(Unknown Source) 2021/07/17 20:31:59.789 31975 32024 Error Unity at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <000000000000000000

By referring at debug it happened at AndroidNotificationCenter.RegisterNotificationChannel(channel);

Here is some more info about script

Debug.Log("----Fillimi i MobileNotification----");

        var channel = new AndroidNotificationChannel()
        {
            Id = "channel_id",
            Name = "Default Channel",
            Importance = Importance.Default,
            Description = "Generic notifications",
        };
        Debug.Log("*********************************----Fundi i var channel  = new AndroidNotificationChannel() ----*********************************");

        AndroidNotificationCenter.RegisterNotificationChannel(channel);
        Debug.Log("*********************************----Fundi i  AndroidNotificationCenter.RegisterNotificationChannel(channel)----*********************************");