Search Unity

Question Class Not Found Exception on mobile build

Discussion in 'LevelPlay' started by mech_alina, Jan 9, 2023.

  1. mech_alina

    mech_alina

    Joined:
    Nov 3, 2020
    Posts:
    27
    Trying to migrate from Unity Ads Mediation to IronSource. Currently getting a Class Not Found Exception on the mobile build when trying to play a rewarded video ad (seen with Android Log Cat).

    Steps taken so far:
    • app key in script
    • uninstall unity ads
    • install ironsource levelplay
    • put app key in settings
    • created IronSource account and entered in test Android phone details
    • installed networks on integration manager (everything is up to date on latest adapter version)
    • Google Play services permission per migration guide for Unity(https://developers.is.com/ironsource-mobile/unity/unity-plugin/#step-3)
    • Resolve and force resolve dependencies
    • Unity 2020+ gradle.properties (I currently use Unity 2021.2.9f1)


    I've followed the migration guide step by step, more details are needed in the documentation. I do not use proguard and do not have it enabled and thus not followed those steps in the documentation.


    Error:
    Code (CSharp):
    1. 2023/01/10 12:59:28.337 10067 10125 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.ironsource.unity.androidbridge.AndroidBridge
    2. 2023/01/10 12:59:28.337 10067 10125 Error Unity java.lang.ClassNotFoundException: com.ironsource.unity.androidbridge.AndroidBridge
    3. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at java.lang.Class.classForName(Native Method)
    4. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at java.lang.Class.forName(Class.java:454)
    5. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    6. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
    7. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
    8. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at android.os.Handler.dispatchMessage(Handler.java:102)
    9. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at android.os.Looper.loopOnce(Looper.java:201)
    10. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at android.os.Looper.loop(Looper.java:288)
    11. 2023/01/10 12:59:28.337 10067 10125 Error Unity     at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    12. 2023/01/10 12:59:28.337 10067 10125 Error Unity Caused by: java.lang.ClassNotFoundException: com.ironsource.unity.androidbridge.AndroidBridge
    13. 2023/01/10 12:59:28.337 10067 10125 Error Unity     ... 9 more
    14. 2023/01/10 12:59:28.337 10067 10125 Error Unity   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    15. 2023/01/10 12:59:28.337 10067 10125 Error Unity   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
    16. 2023/01/10 12:59:28.337 10067 10125 Error Unity   at UnityEngi
    17.  
     
    Last edited: Jan 9, 2023
  2. ej-Unity

    ej-Unity

    Unity Technologies

    Joined:
    May 13, 2021
    Posts:
    27
  3. mech_alina

    mech_alina

    Joined:
    Nov 3, 2020
    Posts:
    27
    Okay will do
     
  4. mech_alina

    mech_alina

    Joined:
    Nov 3, 2020
    Posts:
    27
  5. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    Bit of a shot in the dark, but have you seen any errors in the console when resolving dependencies? Your error indicates missing classes, which would be in line with an issue downloading the relevant dependencies.
     
  6. mech_alina

    mech_alina

    Joined:
    Nov 3, 2020
    Posts:
    27
    No errors with resolving dependencies. Still waiting on IronSource team to respond to my request. Any other suggestions in mean time?
     
  7. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    In your project, do you see Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge?
     
  8. alond357

    alond357

    Unity Technologies

    Joined:
    Jan 17, 2023
    Posts:
    3
    Please move the jar from Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge.jar
    to Assets/IronSource/Plugins/Android and build.
    See if it still happens
     
    SK_Unity_Support likes this.
  9. mech_alina

    mech_alina

    Joined:
    Nov 3, 2020
    Posts:
    27
    ^Yes, I do see this in the project.

    Alond357, trying your suggestion now
     
  10. mech_alina

    mech_alina

    Joined:
    Nov 3, 2020
    Posts:
    27
    Getting an error on build to the android phone here after moving the android-bridge file
    link to screenshot of errors: https://ibb.co/WHvVc9c


    Error code snippet:

    Code (CSharp):
    1. Note: C:\Users\Alina\XXX\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
    2. Note: Recompile with -Xlint:deprecation for details.
    3. Note: Some input files use unchecked or unsafe operations.
    4. Note: Recompile with -Xlint:unchecked for details.
    5. java.util.NoSuchElementException: Key C:\Users\Alina\.gradle\caches\transforms-2\files-2.1\ad38681eaa06eaccdf7d5833b34c2e9b\jetified-com.parse.bolts.bolts-applinks-1.4.0.jar is missing in the map.
     
    Last edited: Jan 19, 2023
  11. freeslx

    freeslx

    Joined:
    Jul 18, 2022
    Posts:
    1
    have same problem any update ?

    2023/02/22 17:55:24.651 14434 14475 Error Unity AndroidJavaException: java.lang.ClassNotFoundException: com.ironsource.unity.androidbridge.AndroidBridge
    2023/02/22 17:55:24.651 14434 14475 Error Unity java.lang.ClassNotFoundException: com.ironsource.unity.androidbridge.AndroidBridge
    2023/02/22 17:55:24.651 14434 14475 Error Unity at java.lang.Class.classForName(Native Method)
    2023/02/22 17:55:24.651 14434 14475 Error Unity at java.lang.Class.forName(Class.java:454)
    2023/02/22 17:55:24.651 14434 14475 Error Unity at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    2023/02/22 17:55:24.651 14434 14475 Error Unity at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
    2023/02/22 17:55:24.651 14434 14475 Error Unity at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:83)
    2023/02/22 17:55:24.651 14434 14475 Error Unity at android.os.Handler.dispatchMessage(Handler.java:102)
    2023/02/22 17:55:24.651 14434 14475 Error Unity at android.os.Looper.loopOnce(Looper.java:210)
    2023/02/22 17:55:24.651 14434 14475 Error Unity at android.os.Looper.loop(Looper.java:299)
    2023/02/22 17:55:24.651 14434 14475 Error Unity at com.unity3d.player.UnityPlayer$e.run(Unknown Source:24)
    2023/02/22 17:55:24.651 14434 14475 Error Unity Caused by: java.lang.ClassNotFoundException: com.ironsource.unity.androidbridge.AndroidBridge
    2023/02/22 17:55:24.651 14434 14475 Error Unity ... 9 more
    2023/02/22 17:55:24.651 14434 14475 Error Unity at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    2023/02/22 17:55:24.651 14434 14475 Error Unity at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
     
  12. IvanArantes

    IvanArantes

    Joined:
    Aug 26, 2020
    Posts:
    1
    any update on this?
     
  13. mech_alina

    mech_alina

    Joined:
    Nov 3, 2020
    Posts:
    27
    No update on my end. Email from LevelPlay team said reference this thread. Issue is not resolved. Please provide other solutions! Thanks!
     
  14. hellaeon

    hellaeon

    Joined:
    Jul 20, 2010
    Posts:
    90
    This worked for me, and ensure you tick the android platform box. Also, make sure you init your ads correctly for the platform you want.
     
  15. d_sharov

    d_sharov

    Joined:
    Dec 24, 2021
    Posts:
    23
    I'm getting a similar problem when running an android application, but with a slightly different error.
    Followed the initialization documentation. Already wrote to the support.
    Also found an issue with ios build after installing Unity.Ads Adapter. No specific errors are shown in Cloud's console.

    C:\workspace\workspace\p\Assets\Scripts\Monetization\Application\IronSourceWrapper.cs: UnityEngine.AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/ISDemandOnlyInterstitialListener;
    at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <00000000000000000000000000000000>:0
    at IronSourceConfig..ctor () [0x00000] in <00000000000000000000000000000000>:0
    at IronSourceConfig.get_Instance () [0x00000] in <00000000000000000000000000000000>:0
    at Monetization.Application.IronSourceWrapper.InitAsync () [0x00000] in <00000000000000000000000000000000>:0
    at Monetization.Application.IronSourceWrapper.InitAsync () [0x00000] in <00000000000000000000000000000000>:0
    at Management.InitializationManager.StartUpAsync () [0x00000] in <00000000000000000000000000000000>:0
    at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at Management.PlayerDataManager.LoadPlayerDataAsync () [0x00000] in <00000000000000000000000000000000>:0
    at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at Management.StoryLoader.LoadStoryAsync () [0x00000] in <00000000000000000000000000000000>:0
    at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at Network.StoryAPI.GetStoriesAsync () [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.AwaitTaskContinuation.RunCallback (System.Threading.ContextCallback callback, System.Object state, System.Threading.Tasks.Task& currentTask) [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.Task.FinishContinuations () [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at RR.Network.Rest.API`1[TK].GetAsync[T] (System.String route, System.Func`2[T,TResult] customDeserialization) [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
    at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.AwaitTaskContinuation.RunCallback (System.Threading.ContextCallback callback, System.Object state, System.Threading.Tasks.Task& currentTask) [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.Task.FinishContinuations () [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at RR.Network.Rest.API`1[TK].FormAndSendRequestAsync[T] (System.String route, BestHTTP.HTTPMethods method, System.Object content, System.Boolean isForm, System.Func`2[T,TResult] customDeserialization) [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
    at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.AwaitTaskContinuation.RunCallback (System.Threading.ContextCallback callback, System.Object state, System.Threading.Tasks.Task& currentTask) [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.Task.FinishContinuations () [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at System.Threading.Tasks.TaskCompletionSource`1[TResult].TrySetResult (TResult result) [0x00000] in <00000000000000000000000000000000>:0
    at BestHTTP.Core.RequestEventHelper.HandleRequestStateChange (BestHTTP.Core.RequestEventInfo event) [0x00000] in <00000000000000000000000000000000>:0
    at BestHTTP.Core.RequestEventHelper.ProcessQueue () [0x00000] in <00000000000000000000000000000000>:0
    at BestHTTP.HTTPManager.OnUpdate () [0x00000] in <00000000000000000000000000000000>:0
    at BestHTTP.HTTPUpdateDelegator.CallOnUpdate () [0x00000] in <00000000000000000000000000000000>:0
    InitAsync:73

    RR.Core.DebugSystem.RRLogger:Error(Exception, String, String, String, Int32)
    Monetization.Application.<InitAsync>d__6:MoveNext()
    Monetization.Application.IronSourceWrapper:InitAsync()
    Management.<StartUpAsync>d__40:MoveNext()
    Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1:TrySetResult(TResult)
    Management.<LoadPlayerDataAsync>d__15:MoveNext()
    Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1:TrySetResult(TResult)
    Management.<LoadStoryAsync>d__11:MoveNext()
    Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1:TrySetResult(TResult)
    Network.<GetStoriesAsync>d__5:MoveNext()
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(TResult)
    RR.Network.Rest.<GetAsync>d__23`1:MoveNext()
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(TResult)
    RR.Network.Rest.<FormAndSendRequestAsync>d__78`1:MoveNext()
    System.Threading.Tasks.TaskCompletionSource`1:TrySetResult(TResult)
    BestHTTP.Core.RequestEventHelper:HandleRequestStateChange(RequestEventInfo)
    BestHTTP.Core.RequestEventHelper:processQueue()
    BestHTTP.HTTPManager:OnUpdate()
    BestHTTP.HTTPUpdateDelegator:CallOnUpdate()legatorate()
    BestHTTP.HTTPUpdateDelegator:CallOnUpdate()legator:CallOnUpdate()
     
  16. PeterGost

    PeterGost

    Joined:
    Jan 27, 2020
    Posts:
    18
    The same problem here!!!

    Is it a problem with obfuscating? I used Android SDK 33 and in order to make a build I needed to use R8.
    Is there a file that needs to be updated?
     
  17. Arkanagames

    Arkanagames

    Joined:
    Apr 29, 2022
    Posts:
    1
    I've got the same problem. I solved it by:
    1. Delete the "Library" folder, and wait the Unity to recompile the project.
    2. Update the Iron Source Integration Manager (including all the adapters version).
    3. Move the jar from Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge.jar to Assets/IronSource/Plugins/Android
    4. "Update" the "Version Handler" from "External Dependency Manager"
    5. Make sure all the integration requirements already implemented, such as IronSource AppKey, Android Manifest, Gradle, and Android Resolver settings
    6. Build

    Note: I was using Android platform

    Hope this could help.
     
    Last edited: Apr 14, 2023
    VOXELIUM likes this.
  18. PeterGost

    PeterGost

    Joined:
    Jan 27, 2020
    Posts:
    18
    The same issue here!!! This is just not acceptable!!!

    It was working fine, then I made a new build, and bump up the version, and on one phone it continued to work on the other one I got this error! Both devices use different accounts.

    Did anyone find any solution to this?
     
  19. marsilo90

    marsilo90

    Joined:
    Mar 18, 2023
    Posts:
    1
    i have fixed by remove one of the ironsource plugin navigate to this folder Assets/IronSource/Plugins/Android/IronSource.plugin and you will find tow file with same name! the problem related when importing the new version of ironsource is make duplicated!!
     
  20. VOXELIUM

    VOXELIUM

    Joined:
    Nov 24, 2022
    Posts:
    49
    i also have error
    2023/08/26 22:34:33.689 12750 12774 Error Unity at IronSourceEventsDispatcher.Update () [0x00000] in <00000000000000000000000000000000>:0




    the suggested solution does not help
     
  21. uranaka

    uranaka

    Joined:
    Jul 14, 2021
    Posts:
    6
  22. vagelis199

    vagelis199

    Joined:
    Jul 27, 2012
    Posts:
    182
  23. uranaka

    uranaka

    Joined:
    Jul 14, 2021
    Posts:
    6
    After updating LevelPlay to the latest version, you should have a folder called IronSource.plugin and IronSource.androidlib in Assets/IronSource/Plugins/Android.

    Then remove IronSource.plugin.

    Good luck!
     
  24. vagelis199

    vagelis199

    Joined:
    Jul 27, 2012
    Posts:
    182
    You are right, I updated it from the IronSource website, I had the version from the Package Manager instead.
     
  25. mateuszwallace

    mateuszwallace

    Joined:
    Dec 13, 2019
    Posts:
    17
    I had the same issue with duplicated names of android-bridge and ironsource-bridge.
    So I reinstall the ironsource skd but this time before the coping of the LevelPlay packages I removed the Ads Mediation and Advertisement Legacy from the Unity by usign the Package Manager and it worked for me.
     
  26. VOXELIUM

    VOXELIUM

    Joined:
    Nov 24, 2022
    Posts:
    49
    ironsource said it's not a problem
     
  27. Kiselev_Aleksander

    Kiselev_Aleksander

    Joined:
    Jun 22, 2022
    Posts:
    1
    I am having the same issue, but there is not such file. There is only "Assets\IronSource\Plugins\Android\IronSource.androidlib\libs\IronSource-bridge.jar"