Cannot build project with Push Notifications added

I’ve tried just about everything I can think of, and there is no information on this in the documentation. When I try to build for Android, the build fails with “too many errors” and gives a bunch of duplicate class errors.

When I try to build in xCode for iOS, I get errors instantly that the notificationservice requires a development profile. Selecting my existing development team doesn’t work, it just throws errors. Can someone please provide a guide on how to build a project for both Android and iOS?

As of right now I had to remove Push Notifications completely from my project in order to build :frowning:

Unity 2022.1.15f1
Unity Mediation is also in my project.

Hi Cameron,
Thanks for posting here.
I’ve messaged the engineering team and we should be getting back to you shortly. I haven’t personally tried the latest version yet and will try to let you know if I run into the same errors.

Hello, I am experiencing the exact same issue. Does anyone have a solution to this problem?

Hi there,
Thanks for posting on the forums.
Could you confirm the packages you have in your project?

I have added Firebase Analytics and Firebase Authentication. The issue was present even when I only had Firebase Authentication - after I build the project from Unity for iOS on my Windows and then I try to build it from xcode, it throws the error “notificationservice requires a development profile”.
I did not experience any of these problems before I added Push Notifications and Firebase to my project.

1 Like

Hey folks,
We’ve released a new version of Push Notifications 3.0.1-pre.1 patch is live!
This should avoid Firebase duplicate dll errors.

You can pull the file through the package manager by adding package from git url or add package by name and putting
com.unity.services.push-notifications.

Please let us know if this new version fixes these duplicate errors.

@SebT_Unity The duplicate class problem solved, but on initialization I get the following ClassNotFoundExceptions:

2023. 04. 01 09:18:09.770 19053 19130 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
2023. 04. 01 09:18:09.770 19053 19130 Error Unity java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at java.lang.Class.classForName(Native Method)
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at java.lang.Class.forName(Class.java:454)
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer.access$500(Unknown Source:0)
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:114)
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at android.os.Handler.dispatchMessage(Handler.java:106)
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at android.os.Looper.loop(Looper.java:219)
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
2023. 04. 01 09:18:09.770 19053 19130 Error Unity Caused by: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
2023. 04. 01 09:18:09.770 19053 19130 Error Unity     ... 8 more
2023. 04. 01 09:18:09.770 19053 19130 Error Unity   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
2023. 04. 01 09:18:09.770 19053 19130 Error Unity   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
2023. 04. 01 09:18:09.770 19053 19130 Error Unity   at UnityEngine
2023. 04. 01 09:18:10.519 19053 19130 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
2023. 04. 01 09:18:10.519 19053 19130 Error Unity java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at java.lang.Class.classForName(Native Method)
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at java.lang.Class.forName(Class.java:454)
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer.access$500(Unknown Source:0)
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:114)
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at android.os.Handler.dispatchMessage(Handler.java:106)
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at android.os.Looper.loop(Looper.java:219)
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
2023. 04. 01 09:18:10.519 19053 19130 Error Unity Caused by: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
2023. 04. 01 09:18:10.519 19053 19130 Error Unity     ... 8 more
2023. 04. 01 09:18:10.519 19053 19130 Error Unity   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
2023. 04. 01 09:18:10.519 19053 19130 Error Unity   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
2023. 04. 01 09:18:10.519 19053 19130 Error Unity   at UnityEngine
1 Like

@SebT_Unity Any news on this?

@domonyiv , I’ve brought this to the attention of the developers.Unfortunately without the source code we aren’t able to give you a reason why this would be happening. Would it be possible to send us a stripped version of your code with the errors?

This may require some work on your end apologies it would be the best way for us to debug the issue.

Please DM me directly so we can help you out if you can send us some sort of sample project.

@SebT_Unity Is the developers (or the QA team) really testing these releases? :slight_smile: I can reproduce these errors on a new empty project with the sample file from the package. All I have to do is turn it on the Minify > Release checkbox at the Publish Settings. If I turn it off, the error disappears.

It is probably a proguard problem and it needs a “-keep class com.unity.services.pushnotifications” or something like this, but I don’t have the time to test it now.

1 Like

Hi Domonyiv,

Thanks and I will bring your feedback to our team and appreciate the feedback.

We’ve tested this locally and can confirm you can either disable minify or add the following to your proguard.

To enable a custom proguard in Unity editor go to:
EDIT > PROJECT SETTINGS > PLAYER > PUBLISH SETTINGS > BUILD > CUSTOM PROGUARD FILE
8962884--1231458--upload_2023-4-20_13-53-30.png

Then open the file created under the path specified and append the following line
-keep class com.unity.services.pushnotifications** { *;}

Keep us posted if you have success or continue running into a wall.

1 Like

I was Having the same error
“AndroidJavaException: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityPushNotificationsCallback”

It got fix by this answer