Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

AndroidJavaException: java.lang.ClassNotFoundException: com.unity.udp.sdk.ChannelService

Discussion in 'Unity Distribution Portal (UDP)' started by mudloop, Mar 31, 2020.

  1. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    Hi,

    I'm trying to get a game ready for UDP, using the Unity IAP plugin.

    I'm getting this error :

    And here's my initialization code :

    Code (CSharp):
    1. ConfigurationBuilder builder = ConfigurationBuilder.Instance (StandardPurchasingModule.Instance (AppStore.UDP));
    2. foreach (var kv in BillingManager.products) {
    3.     BillingProduct p = kv.Value;
    4.     builder.AddProduct (p.GetKey (store), p.isConsumable ? ProductType.Consumable : ProductType.NonConsumable);
    5. }
    6. UnityPurchasing.Initialize (iapListener, builder);
    Any help would be appreciated. Thanks!
     
  2. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    I figured it out, my build tools had overwritten the plugin's setting so it wasn't properly targeting UDP, so that was my bad. All good now.
     
    SamOYUnity3D likes this.
  3. GearsSoldier

    GearsSoldier

    Joined:
    Sep 30, 2018
    Posts:
    1
    Could you try to make a step by step of how you resolve this?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Typically it would be from the Window/Unity IAP/Android/Target UDP menu in the Unity Editor.
     
  5. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    113
    I need to make a build for google play, so I have to set the target to target google play, and now I get this error, how to I fix it?
     
  6. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @peeka,

    Which error are you getting on GooglePlay, exactly?
     
  7. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    113
    I am on unity 2019.4.20f1 , IAP in pakcagemanager it says it's 2.2.2, in services it says it's 2.2.7

    when I select unity IAP -> Android -> Target UDP everything works fine,
    but now I need to make a google play build, so I select IAP -> Android -> Target Google Play.

    the aab file for google is built, and pushed to mobile device, when I ran the game, I got this error.
    Code (CSharp):
    1.  
    2. 2021/02/15 19:19:44.975 17294 17315 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.unity.udp.sdk.ChannelService
    3. 2021/02/15 19:19:44.975 17294 17315 Error Unity java.lang.ClassNotFoundException: com.unity.udp.sdk.ChannelService
    4. 2021/02/15 19:19:44.975 17294 17315 Error Unity     at java.lang.Class.classForName(Native Method)
    5. 2021/02/15 19:19:44.975 17294 17315 Error Unity     at java.lang.Class.forName(Class.java:454)
    6. 2021/02/15 19:19:44.975 17294 17315 Error Unity     at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    7. 2021/02/15 19:19:44.975 17294 17315 Error Unity     at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
    8. 2021/02/15 19:19:44.975 17294 17315 Error Unity     at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:83)
    9. 2021/02/15 19:19:44.975 17294 17315 Error Unity     at android.os.Handler.dispatchMessage(Handler.java:103)
    10. 2021/02/15 19:19:44.975 17294 17315 Error Unity     at android.os.Looper.loop(Looper.java:214)
    11. 2021/02/15 19:19:44.975 17294 17315 Error Unity     at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    12. 2021/02/15 19:19:44.975 17294 17315 Error Unity Caused by: java.lang.ClassNotFoundException: com.unity.udp.sdk.ChannelService
    13. 2021/02/15 19:19:44.975 17294 17315 Error Unity     ... 8 more
    14. 2021/02/15 19:19:44.975 17294 17315 Error Unity   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    15. 2021/02/15 19:19:44.975 17294 17315 Error Unity   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
    16. 2021/02/15 19:19:44.975 17294 17315 Error Unity   at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <000000000000000000
    17.  
    18.  
    I previously had UDP installed from packagemanager, I have now uninstalled it, and only use latest version IAP 2.2.7 and it comes with UDP

    I tried aab and apk, both same error
     
    Last edited: Feb 16, 2021
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Are you using code stripping or ProGuard settings? Can you provide detailed steps to reproduce, perhaps start with the Sample IAP Project and upgrade? https://forum.unity.com/threads/sample-iap-project.529555/
     
  9. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,107
    Sorry, didn't see this before - but no, I have no idea, sorry. Been a long time since I made Android builds, and I don't remember how I solved it.
     
  10. aubreypuan

    aubreypuan

    Joined:
    Mar 30, 2017
    Posts:
    9
    Hey there, what build tools of yours have overwrite the settings, can you share it? I have encountered the same issues, switched target store to UDP instead of Playstore, but udp.sdk class not found error still shows up.
     
  11. Alxander_Watson

    Alxander_Watson

    Joined:
    Mar 11, 2017
    Posts:
    16
    For me, I fixed this issue by changing the build settings from debug to release.
    Project Settings -> Player -> Publishing Settings -> Minify -> Tick Release. Untick Debug.
     
  12. korotaevnikita73

    korotaevnikita73

    Joined:
    Dec 24, 2017
    Posts:
    26
  13. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    And it works without the proguard settings? Are you targeting UDP? Ensure to be using IAP 4.1.2 (In App Purchasing in Package Manager)
     
  14. korotaevnikita73

    korotaevnikita73

    Joined:
    Dec 24, 2017
    Posts:
    26
    Oh, I am sorry Jeff, its actually very similar not the same error. I have almost the same thing but with Google Play services. You can check out my other threads that I posted, there are a lot of screenshots:
    https://github.com/playgameservices/play-games-plugin-for-unity/issues/3111
    https://github.com/googlesamples/unity-jar-resolver/issues/497
    https://forum.unity.com/threads/goo...n-in-and-leaderboard-are-not-showing.1226160/
     
  15. korotaevnikita73

    korotaevnikita73

    Joined:
    Dec 24, 2017
    Posts:
    26
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you answer my first question please?
     
  17. nemanjab

    nemanjab

    Joined:
    Jan 10, 2019
    Posts:
    12
    Hey, I have the same issue now. upload_2022-3-10_15-50-2.png

    I'm using Unity IAP package 4.1.3 and UDP package 2.2.5 is added via Package Manager (both latest version at this moment)
    upload_2022-3-10_15-53-13.png

    These are my settings, I need these custom gradles for ad mediation sdk (FairBid).

    Is there anything I need to add in gradle?
    I did force resolve with external dependency manager, but it didn't help.

    Thanks in advance @JeffDUnity3D !
     
  18. nemanjab

    nemanjab

    Joined:
    Jan 10, 2019
    Posts:
    12
    I also get this error log when I go through implementation guide option that comes with UDP
    Settings are connected with my game, IAP packages are pulled.
    upload_2022-3-10_15-56-25.png

    I select option for Unity IAP implementation with code.


    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TutorialCallbacks+<>c.<PackmanCheck>b__10_1 (UnityEditor.PackageManager.PackageInfo x) (at Library/PackageCache/com.unity.purchasing.udp@2.2.5/Editor/Tutorial/Editor/TutorialCallbacks.cs:79)
    3. System.Collections.Generic.List`1[T].Find (System.Predicate`1[T] match) (at <9577ac7a62ef43179789031239ba8798>:0)
    4. TutorialCallbacks.PackmanCheck () (at Library/PackageCache/com.unity.purchasing.udp@2.2.5/Editor/Tutorial/Editor/TutorialCallbacks.cs:79)
    5. SerializableCallback.InvokableCallback`1[TReturn].Invoke (System.Object[] args) (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/ThirdParty/SerializableCallback/InvokableCallback.cs:32)
    6. SerializableCallback.SerializableCallback`1[TReturn].Invoke () (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/ThirdParty/SerializableCallback/SerializableCallback.cs:23)
    7. Unity.Tutorials.Core.Editor.ArbitraryCriterion.EvaluateCompletion () (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/Criteria/ArbitraryCriterion.cs:47)
    8. Unity.Tutorials.Core.Editor.Criterion.UpdateCompletion () (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/Criteria/Criterion.cs:99)
    9. Unity.Tutorials.Core.Editor.ArbitraryCriterion.StartTesting () (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/Criteria/ArbitraryCriterion.cs:57)
    10. Unity.Tutorials.Core.Editor.TutorialPage.SetupCompletionRequirements () (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/Models/TutorialPage.cs:371)
    11. Unity.Tutorials.Core.Editor.TutorialPage.Initiate () (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/Models/TutorialPage.cs:327)
    12. Unity.Tutorials.Core.Editor.Tutorial.RaisePageInitiated (Unity.Tutorials.Core.Editor.TutorialPage page, System.Int32 index) (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/Models/Tutorial.cs:406)
    13. Unity.Tutorials.Core.Editor.Tutorial.TryGoToNextPage () (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/Models/Tutorial.cs:329)
    14. Unity.Tutorials.Core.Editor.TutorialWindow.OnNextButtonClicked () (at Library/PackageCache/com.unity.learn.iet-framework@2.0.0/Editor/Editor Windows/TutorialWindow.cs:1325)
    15. UnityEngine.UIElements.Clickable.Invoke (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    16. UnityEngine.UIElements.Clickable.ProcessUpEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.Vector2 localPosition, System.Int32 pointerId) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    17. UnityEngine.UIElements.Clickable.OnMouseUp (UnityEngine.UIElements.MouseUpEvent evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    18. UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    19. UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    20. UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    21. UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    22. UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    23. UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    24. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    25. UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    26. UnityEngine.UIElements.EventDispatcher.OpenGate () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    27. UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    28. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    29. UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    30. UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    31. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    32. UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    33. UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    34. UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <3cdf672c21b849dea215f9c9aff21f77>:0)
    35. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <a8eb1be68acb4659af00824c7808e2c0>:0)
     
  19. nemanjab

    nemanjab

    Joined:
    Jan 10, 2019
    Posts:
    12
  20. Horus-Glass

    Horus-Glass

    Joined:
    Nov 2, 2014
    Posts:
    3
    Hey, I have the same issue now.
    Do you resolve this?
    Could you try to make a step by step of how you resolve this?