Unity-Technologies / NotificationsSamples

Sample project for Unity Notifications
Other
282 stars 51 forks source link

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; #62

Closed Indrit-Vaka closed 3 years ago

Indrit-Vaka commented 3 years ago

Full error 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; 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; at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.access$300(Unknown Source) at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:154) at com.unity3d.player.UnityPlayer$e.run(Unknown Source) at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <000000000000000000

Found solution here https://github.com/Unity-Technologies/NotificationsSamples/issues/30 by adding those lines to proguard fle

-keep class com.unity.* { ;} -keep class com.unity.androidnotifications. { ;} -keepclassmembers class com.unity.androidnotifications. { ;} -keepnames class com.unity.androidnotifications. { ;} -keepclassmembernames class com.unity.androidnotifications. { ;}

I found the proguard file by searching in my project folder and I added those lines on file named proguard , and in this one proguard-android.txt-3.6.0 i added the lines out of parentheses in the end off text file

here is modified files

pergout files.zip

aurimasc commented 3 years ago

If you use minification, you have use such proguard settings.

Indrit-Vaka commented 3 years ago

If you use minification, you have use such proguard settings.

I am using those package: adMob advertisement notification and some other but only admob isn't from unity teach

Artein commented 2 years ago

@aurimasc , please add those settings to MobileNotifictions documentation. Such behaviours is not expected