Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. We are looking for your feedback about Templates! Tell us about your experiences by taking our survey.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

Discussion in 'Unity IAP' started by mudloop, Mar 31, 2020.

  1. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,094
    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,094
    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

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    9,314
    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:
    105
    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

    Unity Technologies

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

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

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    105
    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

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    9,314
    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/
     
unityunity