Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Bug Cannot build project with Push Notifications added

Discussion in 'Player Engagement' started by CameronDWills, Sep 1, 2022.

  1. CameronDWills

    CameronDWills

    Joined:
    Feb 26, 2021
    Posts:
    94
    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 :(

    Unity 2022.1.15f1
    Unity Mediation is also in my project.
     
  2. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    283
    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.
     
  3. MihailLuhov

    MihailLuhov

    Joined:
    Aug 10, 2020
    Posts:
    6
    Hello, I am experiencing the exact same issue. Does anyone have a solution to this problem?
     
  4. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    283
    Hi there,
    Thanks for posting on the forums.
    Could you confirm the packages you have in your project?
     
  5. MihailLuhov

    MihailLuhov

    Joined:
    Aug 10, 2020
    Posts:
    6
    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.
     
    SebT_Unity likes this.
  6. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    283
    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.
     
  7. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    79
    @SebT_Unity The duplicate class problem solved, but on initialization I get the following ClassNotFoundExceptions:

    Code (CSharp):
    1. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
    2. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
    3. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at java.lang.Class.classForName(Native Method)
    4. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at java.lang.Class.forName(Class.java:454)
    5. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    6. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer.access$500(Unknown Source:0)
    7. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:114)
    8. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at android.os.Handler.dispatchMessage(Handler.java:106)
    9. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at android.os.Looper.loop(Looper.java:219)
    10. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    11. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity Caused by: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
    12. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity     ... 8 more
    13. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    14. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
    15. 2023. 04. 01 09:18:09.770 19053 19130 Error Unity   at UnityEngine
    16. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
    17. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
    18. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at java.lang.Class.classForName(Native Method)
    19. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at java.lang.Class.forName(Class.java:454)
    20. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    21. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer.access$500(Unknown Source:0)
    22. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:114)
    23. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at android.os.Handler.dispatchMessage(Handler.java:106)
    24. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at android.os.Looper.loop(Looper.java:219)
    25. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    26. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity Caused by: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityCallbackClass
    27. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity     ... 8 more
    28. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    29. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
    30. 2023. 04. 01 09:18:10.519 19053 19130 Error Unity   at UnityEngine
    31.  
     
    SebT_Unity likes this.
  8. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    79
    @SebT_Unity Any news on this?

     
  9. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    283
    @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.
     
  10. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    79
    @SebT_Unity Is the developers (or the QA team) really testing these releases? :) 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.
     
    Last edited: Apr 19, 2023
    SebT_Unity likes this.
  11. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    283
    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
    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.
     
    tauseefnasir501 likes this.
  12. tauseefnasir501

    tauseefnasir501

    Joined:
    Apr 2, 2021
    Posts:
    7
    I was Having the same error
    "AndroidJavaException: java.lang.ClassNotFoundException: com.unity.services.pushnotifications.android.UnityPushNotificationsCallback"

    It got fix by this answer