Search Unity

Bug Push Notification documentation out of date

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

  1. CameronDWills

    CameronDWills

    Joined:
    Feb 26, 2021
    Posts:
    91
    Integration (unity.com)

    I've been trying to follow the integration for Push Notifications but the outdated documentation and code has been giving me trouble. First, it tells you to add an older version to your manifest file. 2.0.0-pre2 is the current version as of this post, but the documentation has you add in 1.1.0-pre2.

    Also, I tried to add the sample script to register for push notifications found here: Push Notifications SDK documentation | Push Notifications | 2.0.0-pre.2 (unity3d.com)

    But the code is wrong. It tells you to call "PushNotificationService.Instance" but this won't work, because the correct name is PushNotificationsService.Instance

    The documentation was also unclear if the firebase SDK needed to be added to the project. When setting up firebase for the first time, and creating the app within firebase to get the app ID, the instructions prompt you to install firebase SDK to your unity project. I also use the Unity Mediation service, which has files that conflict with the firebase SDK (specifically the resolver files), so I deleted the external dependancy manager that came with the Firebase SDK but now I have an error in my project:

    Code (CSharp):
    1.  
    2. TypeLoadException: Could not resolve type with token 01000074 from typeref (expected class 'Google.EditorInitializer' in assembly 'Google.VersionHandlerImpl, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null')
    3. Rethrow as TypeInitializationException: The type initializer for 'Firebase.Editor.GenerateXmlFromGoogleServicesJson' threw an exception.
    4. (wrapper write-barrier) System.Object.wbarrier_conc(intptr)
    5. System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f3aec01a34d14c7080754e28743c8472>:0)
    6. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    7. System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f3aec01a34d14c7080754e28743c8472>:0)
    8. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <f3aec01a34d14c7080754e28743c8472>:0)
    9. UnityEditor.AssetPostprocessingInternal.InvokeMethod (System.Reflection.MethodInfo method, System.Object[] args) (at <f90799373c314538a0c910377078306d>:0)
    10. UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets, System.Boolean didDomainReload) (at <f90799373c314538a0c910377078306d>:0)
    11. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    12.  
    Does the firebase sdk need to be included in the project? What files do I or don't I need to add if any?
     
    Last edited: Sep 1, 2022
  2. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi Cameron,
    Thanks for pointing that out.
    We are still in BETA phase and ironing out some docs.
    I've messaged our docs team about your reports.

    Regarding the FIREBASE SDK:
    Our sdk should pull in files needed to make the push notifications run straight out of the box. Firebase is Googles way of handling android notifications.. Installing Firebase SDK with our SDK will actually cause more issues. (Duplicate DLLS)

    Below is some code that is deprecated but should still work. Put on any game object in your scene. Make sure to install the latest version of Push Notifications SDK

    Code (CSharp):
    1. using System;
    2. using Unity.Services.Core;
    3. using Unity.Services.PushNotifications;
    4. using UnityEngine;
    5. using Unity.Services.Analytics;
    6.  
    7. public class PushNotificationExample : MonoBehaviour
    8. {  
    9.     // Start is called before the first frame update
    10.     async void Start()
    11.     {
    12.         await UnityServices.InitializeAsync();
    13.  
    14.         // Note: This is the minimum required in Analytics version 3.0.0 and above to ensure the events with the push notification data are sent correctly.
    15.         // In a real game you would need to handle privacy consent states here, see the Analytics documentation for more details.
    16.         await Events.CheckForRequiredConsents();
    17.  
    18.  
    19.         // Make sure to set the required settings in Project Settings before testing
    20.         string token = await PushNotifications.RegisterForPushNotificationsAsync();
    21.         Debug.Log($"The push notification token is {token}");
    22.  
    23.         PushNotifications.OnNotificationReceived += notificationData =>
    24.         {
    25.             Debug.Log("Data retrieved!");
    26.         };
    27.     }
    28. }
    Build and release.

    Let me know if this helps. I will make sure to go through the new flow as soon as possible and update this post with more relevant code and steps

    Best
    Seb
     
  3. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hey Cameron,
    I wanted to know if you had any success?
    I recently tried the newest version with the latest correct sample and had success on my end.

    I could list my steps here if you think that would help while we get the documentation adjusted.

    Here are some quick overview steps let me know if I should drill into any steps.

    1. Link your project from the editor by going to EDIT > PROJECT SETTINGS > SERVICES
    2. Make sure you are on ANDROID build
    3. Import the latest Push Notification package into your game
    4. The import should force the right dlls to be pulled.
    5. Make sure you have an account on Firebase
    6. Create a project on the firebase account
    7. Click on Project settings located near project overview
    8. Click on the Service Accounts tab
    9. Click on Generate New Private key (if you don't already have one)
    10. Save the key and upload it to the unity dashboard under DASHBOARD>LIVEOPS>PUSH NOTICATIONS BETA>SETTINGS > GOOGLE KEYS
    11. In the Unity editor create an empty object and drag and drop the PushNotificationExample.cs from the samples project onto that
    12. Save and compile and run the project test out.
    13. Make sure to save and run for Android
    14. Preferably be connected to a pc when testing so you can see the LOGCAT and search for the "The push notification token is"
    15. Now that you have a token you can test it out by going to DASHBOARD>LIVEOPS>PUSH NOTICATIONS BETA>NOTIFICATIONS
    16. Create a notification with any title any date and any group
    17. On the following screen
      upload_2022-9-9_16-14-40.png
    18. Click on Test on Device
    19. Paste in your token under the google token
      upload_2022-9-9_16-15-39.png
    20. You should receive a notification on your android build

    Let me know if you have any questions for the steps above.
     
  4. CameronDWills

    CameronDWills

    Joined:
    Feb 26, 2021
    Posts:
    91
    The problems for me exist when trying to build the android or iOS versions of the game for release in the app stores. For android, I can't build at all because I get duplicate class errors (my project uses Unity Mediation, so I'm wondering if there's conflicting DLL's) but the error logs don't help much in finding out what specifically is causing the conflict. And on iOS, I can't get the xCode project to Archive because I get errors during the build process. Removing the push notifications plugin and trying my build again works perfect, so it's not until I add push notifications to my project that I can no longer build.
     
  5. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Thanks for confirming that Cameron,
    Can you search through the assets of your Unity project for : firebase
    upload_2022-9-12_11-7-31.png


    Could you please send over the screenshot of the DLL's that may be found when searching for that?

    In the meantime I will download the latest version of Unity Mediation and see if any conflicts appear in my test project.
    Look forward to hearing from you.
     
    CameronDWills likes this.
  6. CameronDWills

    CameronDWills

    Joined:
    Feb 26, 2021
    Posts:
    91
    Okay I just added push notifications back to my game and tried to build for android. It failed with these errors:

    Code (CSharp):
    1. FAILURE: Build failed with an exception.
    2.  
    3. * What went wrong:
    4. Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
    5. > 1 exception was raised by workers:
    6.   java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    7.   Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    8.   Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    9.   Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    10.   Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    11.   Duplicate class android.support.v4.os.IResultReceiver found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    12.   Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    13.   Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    14.   Duplicate class android.support.v4.os.ResultReceiver found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    15.   Duplicate class android.support.v4.os.ResultReceiver$1 found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    16.   Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    17.   Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules androidx.core.core-1.2.0-runtime.jar (:androidx.core.core-1.2.0:) and androidx.core.core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    18.   Duplicate class androidx.annotation.AnimRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    19.   Duplicate class androidx.annotation.AnimatorRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    20.   Duplicate class androidx.annotation.AnyRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    21.   Duplicate class androidx.annotation.AnyThread found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    22.   Duplicate class androidx.annotation.ArrayRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    23.   Duplicate class androidx.annotation.AttrRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    24.   Duplicate class androidx.annotation.BinderThread found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    25.   Duplicate class androidx.annotation.BoolRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    26.   Duplicate class androidx.annotation.CallSuper found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    27.   Duplicate class androidx.annotation.CheckResult found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    28.   Duplicate class androidx.annotation.ColorInt found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    29.   Duplicate class androidx.annotation.ColorLong found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    30.   Duplicate class androidx.annotation.ColorRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    31.   Duplicate class androidx.annotation.ContentView found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    32.   Duplicate class androidx.annotation.DimenRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    33.   Duplicate class androidx.annotation.Dimension found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    34.   Duplicate class androidx.annotation.DrawableRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    35.   Duplicate class androidx.annotation.FloatRange found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    36.   Duplicate class androidx.annotation.FontRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    37.   Duplicate class androidx.annotation.FractionRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    38.   Duplicate class androidx.annotation.GuardedBy found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    39.   Duplicate class androidx.annotation.HalfFloat found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    40.   Duplicate class androidx.annotation.IdRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    41.   Duplicate class androidx.annotation.InspectableProperty found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    42.   Duplicate class androidx.annotation.InspectableProperty$EnumEntry found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    43.   Duplicate class androidx.annotation.InspectableProperty$FlagEntry found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    44.   Duplicate class androidx.annotation.InspectableProperty$ValueType found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    45.   Duplicate class androidx.annotation.IntDef found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    46.   Duplicate class androidx.annotation.IntRange found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    47.   Duplicate class androidx.annotation.IntegerRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    48.   Duplicate class androidx.annotation.InterpolatorRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    49.   Duplicate class androidx.annotation.Keep found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    50.   Duplicate class androidx.annotation.LayoutRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    51.   Duplicate class androidx.annotation.LongDef found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    52.   Duplicate class androidx.annotation.MainThread found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    53.   Duplicate class androidx.annotation.MenuRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    54.   Duplicate class androidx.annotation.NavigationRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    55.   Duplicate class androidx.annotation.NonNull found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    56.   Duplicate class androidx.annotation.Nullable found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    57.   Duplicate class androidx.annotation.PluralsRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    58.   Duplicate class androidx.annotation.Px found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    59.   Duplicate class androidx.annotation.RawRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    60.   Duplicate class androidx.annotation.RequiresApi found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    61.   Duplicate class androidx.annotation.RequiresFeature found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    62.   Duplicate class androidx.annotation.RequiresPermission found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    63.   Duplicate class androidx.annotation.RequiresPermission$Read found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    64.   Duplicate class androidx.annotation.RequiresPermission$Write found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    65.   Duplicate class androidx.annotation.RestrictTo found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    66.   Duplicate class androidx.annotation.RestrictTo$Scope found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    67.   Duplicate class androidx.annotation.Size found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    68.   Duplicate class androidx.annotation.StringDef found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    69.   Duplicate class androidx.annotation.StringRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    70.   Duplicate class androidx.annotation.StyleRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    71.   Duplicate class androidx.annotation.StyleableRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    72.   Duplicate class androidx.annotation.TransitionRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    73.   Duplicate class androidx.annotation.UiThread found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    74.   Duplicate class androidx.annotation.VisibleForTesting found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    75.   Duplicate class androidx.annotation.WorkerThread found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    76.   Duplicate class androidx.annotation.XmlRes found in modules androidx.annotation.annotation-1.2.0.jar (androidx.annotation.annotation-1.2.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    77.   Duplicate class androidx.arch.core.executor.ArchTaskExecutor found in modules androidx.arch.core.core-runtime-2.0.0-runtime.jar (:androidx.arch.core.core-runtime-2.0.0:) and androidx.arch.core.core-runtime-2.0.0-runtime.jar (androidx.arch.core:core-runtime:2.0.0)
    78.   Duplicate class androidx.arch.core.executor.ArchTaskExecutor$1 found in modules androidx.arch.core.core-runtime-2.0.0-runtime.jar (:androidx.arch.core.core-runtime-2.0.0:) and androidx.arch.core.core-runtime-2.0.0-runtime.jar (androidx.arch.core:core-runtime:2.0.0)
    79.   Duplicate class androidx.arch.core.executor.ArchTaskExecutor$2 found in modules androidx.arch.core.core-runtime-2.0.0-runtime.jar (:androidx.arch.core.core-runtime-2.0.0:) and androidx.arch.core.core-runtime-2.0.0-runtime.jar (androidx.arch.core:core-runtime:2.0.0)
    80.   Duplicate clas<message truncated>
    when I search for firebase in my assets, I get no results
     
    SebT_Unity likes this.
  7. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Thanks for that information!
    We are attempting to reproduce locally and will try to have more information for you soon.
    In the meantime you can try using the google resolver to attempt to auto resolve the duplicates.
     
  8. CameronDWills

    CameronDWills

    Joined:
    Feb 26, 2021
    Posts:
    91
    I haven't been able to get anything to work :/ any ideas?
     
    Lucas7CL likes this.
  9. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hey Cameron,
    Can you try reproducing on a blank project? If you do It would be wonderful if you can share the source of that blank project, through a direct message or here.

    This would help us repro and get the right teams involve to solve a potential problem.

    Look forward to your response.
     
    Lucas7CL likes this.
  10. Lucas7CL

    Lucas7CL

    Joined:
    Sep 28, 2015
    Posts:
    7
    Hi there, any advances in Unity Push Notifications? documentation is not helping too much, and the intuituve very easy to follow steps seem no one have tried them.
     
  11. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi Lucas,

    We are currently overhauling the documentation for push notifications.What platform are you targeting?
    I don't have a date for the doc updates so in the meantime I can help you out trying to get push notifications integrated.
     
  12. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    492
    In the integration documentation (https://docs.unity.com/push-notifications/Integration.html) it is mentioned to add the line
    "com.unity.services.push-notifications": "3.0.0-pre.1",
    to the manifest.json for package lookup. However, this package is not found, I am still stuck with 2.0.0-pre.2.

    By the way, I have requested access twice now in the last four months and never heard back of anyone... May be worth while to check if the process is still going.
     
  13. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi @MiTschMR,
    Thanks for posting on the forums and apologies that no one has replied to your request.
    Can you please DM your OrgID so I can have your account flagged with the beta notifications?

    The document updates are on their final revision. Thanks for pointing out the version mismatch. The version you have 2.0.0-pre.2. is indeed the latest version.The 3.0.0-pre.1 is a future version.

    Look forward to your DM.
    Best,
    Seb
     
  14. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    Hi @SebT_Unity , I get the same error as above.

    I am trying to implement push notification version 3.0.0-pre1, after import the package and tried to build for android I get duplicate class errors. I am using firebase, and admob. EDM Force resolve doesn't solve the problem.

    Code (CSharp):
    1. FAILURE: Build failed with an exception.
    2.  
    3. * What went wrong:
    4. Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
    5. > 1 exception was raised by workers:
    6.   java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    7.   Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    8.   Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    9.   Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    10.   Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    11.   Duplicate class android.support.v4.os.IResultReceiver found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    12.   Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    13.   Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    14.   Duplicate class android.support.v4.os.ResultReceiver found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    15.   Duplicate class android.support.v4.os.ResultReceiver$1 found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    16.   Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    17.   Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:) and core-1.2.0-runtime.jar (androidx.core:core:1.2.0)
    18.   Duplicate class androidx.annotation.AnimRes found in modules androidx.annotation.annotation-1.3.0.jar (androidx.annotation.annotation-1.3.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    19.   Duplicate class androidx.annotation.AnimatorRes found in modules androidx.annotation.annotation-1.3.0.jar (androidx.annotation.annotation-1.3.0.jar) and annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
    20. ...
     
    SebT_Unity likes this.
  15. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    @SebT_Unity I am out of ideas, do you have any advice how can I solve this? :)
     
    Last edited: Feb 3, 2023
  16. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi Domonyiv
    Reproducing locally and will give you a solution as soon as possible.

    The idea here though is that we need to remove one of the two firebase messaging dlls. I just need to document how to do so and will share it here and also ask the docs team to included it for future users.

    Ill post back here soon.
    Best,
    Seb
     
    domonyiv likes this.
  17. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi Domonyiv,

    What packages are you using with firebase?
    With admob is it an sdk for Unity or a custom implementation?

    Thanks for the additional information. The errors I have aren't the same and attempting to repro to give you a solution. I am getting different errors build failures on my end.

    In the meantime if you have backed up your project can you try removing the duplicated
    I've found the following on stack overflow that may also be help while:

    https://stackoverflow.com/questions...app-inotificationsidechannel-found-in-modules

    https://stackoverflow.com/questions...icateclasses-ionic4-android/56736684#56736684
     
  18. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    @SebT_Unity

    I am using Unity 2021.3.18f, if that matters.

    Firebase is added in the manifest.json file and downloaded from here: https://developers.google.com/unity/archive#firebase

    Code (CSharp):
    1. "dependencies": {
    2.     "com.google.external-dependency-manager": "file:../GooglePackages/com.google.external-dependency-manager-1.2.174.tgz",
    3.     "com.google.firebase.app": "file:../GooglePackages/com.google.firebase.app-10.1.0.tgz",
    4.     "com.google.firebase.crashlytics": "file:../GooglePackages/com.google.firebase.crashlytics-10.1.0.tgz",
    5.     "com.google.firebase.dynamic-links": "file:../GooglePackages/com.google.firebase.dynamic-links-10.1.0.tgz",
    Admob version is 7.3.0 and downloaded from here as a .unitypackage https://github.com/googleads/googleads-mobile-unity/releases

    If I add
    android.useAndroidX=true
    android.enableJetifier=true

    the build still fails but all the duplicate classes are prepended by the "jetified-" string.

    Code (CSharp):
    1. * What went wrong:
    2. Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
    3. > 1 exception was raised by workers:
    4.   java.lang.RuntimeException: Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:)
    5.   Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:)
    6.   Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:)
    7.   Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:)
    8.   Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:)
    9.   Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.2.0-runtime.jar (androidx.core:core:1.2.0) and jetified-androidx.core.core-1.6.0-runtime.jar (:androidx.core.core-1.6.0:)
    10.   Duplicate class androidx.annotation.AnimRes found in modules annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0) and jetified-androidx.annotation.annotation-1.3.0.jar (androidx.annotation.annotation-1.3.0.jar)
    11.   Duplicate class androidx.annotation.AnimatorRes found in modules annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0) and jetified-androidx.annotation.annotation-1.3.0.jar (androidx.annotation.annotation-1.3.0.jar)
    12. ...
    UPDATE:
    I tried it with a new clean project. Added the push notification package then firebase as above, but didn't added admob and the build failed with the same message.

    If I remove the line:
    "com.google.firebase.app": "file:../GooglePackages/com.google.firebase.app-10.1.0.tgz",
    the build succeed.
    So it is clearly a conflict between firebase and push notification.
     
    Last edited: Feb 8, 2023
    SebT_Unity likes this.
  19. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi Domonyiv,

    Originally I believed it was with the firebase.messaging hence why I pushed you towards that solution, However my understanding is that it's the whole package? What features do you use from firebase? Do you require firebase for Admob?

    I am using version 10.4.0 compared to your 10.1.0
    upload_2023-2-8_7-57-56.png

    Would it be possible to send that empty project that is failing? This would help us find a solution quicker.

    I will bring this to our developers and see what the best way forward is.

    Best,
    Seb
     
  20. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    I am only using firebase for crashlytics (I think it is used by many of the developers) and dynamic links.

    I sent a bug report with the project. Here is the issue: https://issuetracker.unity3d.com/is...using-push-notification-and-firebase-packages
     
    Last edited: Feb 9, 2023
  21. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi everyone,
    We are currently looking into a more permanent fix for the issues reported with firebase and duplicates.
    Could someone test the following workaround in their project? Please remember to save your project prior to trying the following workaround:

    Go to Unity Editor > Project Settings > Player > Publish Settings.
    - Turn on Custom Main Gradle Template
    - Turn on Custom Gradle Properties Template


    This successfully resolves the “Duplicate module” issue underlined before. However, it might stumble upon a different issue, where the compiler is unable to resolve some required files.