Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Issue with the Ironsource demo project

Discussion in 'LevelPlay' started by jpom001, Jan 13, 2023.

  1. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    When I go to build the IronSource DemoScene on a device, so I can test ads. I get a failed build due to the below
    It looks to me it is searching for this dependency here :
    https://android-sdk.is.com/ 

    I cant access that repo, so I'm not sure if its down, I need to request access or the dependency does not exist under that artifact name .

    I have found an alternative here:
    https://maven.google.com/web/index.html?q=ironsource#com.google.ads.mediation:ironsource:7.2.6.0

    But changing the Ironsourcesdkdependencies.xml or the mainTemplate.gradle does not work as I think there is other stuff going on forcing it to look in the other repo.

    Questions are:
    Do I need access or does the dependency exist?
    Is there something else wrong with my setup , Ive turned on all of these files to resolve another issue
    upload_2023-1-13_21-10-40.png

    Code (CSharp):
    1.  What went wrong:
    2. Execution failed for task ':launcher:checkDebugDuplicateClasses'.
    3. > Could not resolve all dependencies for configuration ':launcher:debugRuntimeClasspath'.
    4.   The project declares repositories, effectively ignoring the repositories you have declared in the settings.
    5.   You can figure out how project repositories are declared by configuring your build to fail on project repositories.
    6.   See https://docs.gradle.org/7.2/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories for details.
    7.    > Could not find com.ironsource.sdk:mediationsdk:7.2.6.
    8.      Searched in the following locations:
    9.        - https://dl.google.com/dl/android/maven2/com/ironsource/sdk/mediationsdk/7.2.6/mediationsdk-7.2.6.pom
    10.        - https://repo.maven.apache.org/maven2/com/ironsource/sdk/mediationsdk/7.2.6/mediationsdk-7.2.6.pom
    11.        - file:/C:/unityProjects/test1/test2/unityLibrary/libs/mediationsdk-7.2.6.jar
    12.        - file:/C:/unityProjects/test1/test2/unityLibrary/libs/mediationsdk.jar
     
  2. alond357

    alond357

    Unity Technologies

    Joined:
    Jan 17, 2023
    Posts:
    3
    Hey can you share more details please:
    • Your mainTemplate.gradle file.
    • Are you building APK directly or via Android Studio Project?
    • What is the Unity3d version you use?
    • What is the environment you build (Mac, Windows)
    • A demo project that reproduces the issue will be grate.
    This will help a lot to better understand the issue.
    Thanks
     
    jcGrenier likes this.
  3. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    1. I'm only building via unity, in other words I am using unity build and run option in build settings
    upload_2023-1-17_20-47-22.png

    2. This is what that folder looks like that contains my android files, not sure is this ok?
    upload_2023-1-17_20-50-50.png

    3. I uploaded a text file version of mainTemplate.gradle as I had an issue when I uploaded the actual file
    4. My unity version is 2022.2.2 and I am building on Windows but trying to deploy my app to a phone upload_2023-1-17_20-54-6.png

    5. How do you want me to deliver the game? the only scene I am trying to load to my phone is the Ironsource sample scene
     

    Attached Files:

  4. tduriga

    tduriga

    Joined:
    Dec 9, 2015
    Posts:
    52
    I think your problem is something else, you have multiple mediation sdk libraries in your project. You have aar library in your plugins and you also add the library using gradle dependency, even the gradle error suggest that this is the issue, your first error line is:
    Try to remove every ironsource aar, jar and build again. This is the error you will usually get if you have multiple versions or copies of the same library.
     
  5. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    I tried that, build and run and got the same error, unless there is somewhere else I should delete these jars from?
    upload_2023-1-17_21-41-47.png
     
  6. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    I tried that, build and run and got the same error, unless there is somewhere else I should delete these jars from?
    I followed this here , https://developers.is.com/ironsource-mobile/unity/unity-plugin/
    The only thing I did different was install the a package called "Ads Mediation", but that was only because the android resolver does not get installed via the steps in the document above. I posted a question on another forum about that.
     
  7. tduriga

    tduriga

    Joined:
    Dec 9, 2015
    Posts:
    52
  8. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    This worked, my build succeeded and deployed to the phone. However, the scene that loads is just a blue screen.In the editor I see this.
    upload_2023-1-17_22-42-18.png
    While on my phone I see this


    Im not seeing any errors in the logs and I only have this scene from the ironsourcedemo loading. Any ideas, Id expect to see some ads here or at least the same screen as editor?
     
  9. tduriga

    tduriga

    Joined:
    Dec 9, 2015
    Posts:
    52
  10. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    Yes I have it added, you can see on my second post a screen shot of my build settings and there are only two scenes. I've removed the other one now as well and I still see the blue screen?
     
  11. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    You should indeed see a screen similar to what you have in editor. You can check to make sure you included the scene as tduriga suggested, and make sure it is the first one launched. You can also check your logs for errors, or add your own gameObjects and logs to the scene for further debugging.
     
  12. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    I deleted my app on the phone rebuilt clean and that worked.
    I clicked on one of the buttons and the ads did not load, I got this error in the logs. I suspect something needs to be set on the Ironsource side?
    There I've created my app and copied my appkey into the code.
    Ive added my android phone as a test device and entered the advertiser id from my google settings on my phone.
    Ive enabled test mode.
    Even after that when I click on the button for the banner and inertial ad, it does not work. I have enabled these ads on IronSource UI. I am now only using the iron source UI, I have not made any changes on the Unity Monetization UI, Im assuming I only use ironsource now?

    Code (CSharp i>Autoconnected Player "Autoconnected Player" unity-script: ShowInterstitialButtonClicked UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[):
    1. )
    2. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    3. UnityEngine.Debug:Log (object)
    4. IronSourceDemoScript:OnGUI () (at C:/unityProjects/test1/Assets/IronSource/DemoScene/IronSourceDemoScript.cs:187)
    5.  
    6. <i>Autoconnected Player "Autoconnected Player"</i> AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/InitializationListener;
    7. java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/InitializationListener;
    8.   at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    9.   at com.unity3d.player.UnityPlayer.-$$Nest$mnativeRender(Unknown Source:0)
    10.   at com.unity3d.player.UnityPlayer$C$a.handleMessage(Unknown Source:95)
    11.   at android.os.Handler.dispatchMessage(Handler.java:102)
    12.   at android.os.Looper.loopOnce(Looper.java:201)
    13.   at android.os.Looper.loop(Looper.java:288)
    14.   at com.unity3d.player.UnityPlayer$C.run(Unknown Source:24)
    15. Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ironsource.mediationsdk.sdk.InitializationListener" on path: DexPathList[[zip file "/data/app/~~pGkxLu4ZMDXRLMBvash6hw==/com.DefaultCompany.test1--N0OljBQO_Z-5WT7P8aI5Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~pGkxLu4ZMDXRLMBvash6hw==/com.DefaultCompany.test1--N0OljBQO_Z-5WT7P8aI5Q==/lib/arm, /data/app/~~pGkxLu4ZMDXRLMBvash6hw==/com.DefaultCompany.test1--N0OljBQO_Z-5WT7P8aI5Q==/base.apk!/lib/armeabi-v7a, /system/lib, /system_ext/lib, /product/lib]]
    16.   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
    17.   at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    18.   at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    19.   ... 7 more
    20.   at UnityEngine.AndroidJNISafe.CheckException () [0x0008d] in /home/bokken/build/output/unity/unity/Modules/AndroidJNI/AndroidJNISafe.cs:24
    21.   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x0000c] in /home/bokken/build/output/unity/unity/Modules/AndroidJNI/AndroidJNISafe.cs:107
    22.   at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00013] in /home/bokken/build/output/unity/unity/Modules/AndroidJNI/AndroidJava.cs:979
    23.   at UnityEngine.AndroidJavaClass..ctor (System.String className) [0x00008] in /home/bokken/build/output/unity/unity/Modules/AndroidJNI/AndroidJava.cs:973
    24.   at AndroidAgent.getBridge () [0x0000d] in C:\unityProjects\test1\Assets\IronSource\Scripts\AndroidAgent.cs:25
    25.   at AndroidAgent.isInterstitialReady () [0x00001] in C:\unityProjects\test1\Assets\IronSource\Scripts\AndroidAgent.cs:225
    26.   at IronSource.isInterstitialReady () [0x00001] in C:\unityProjects\test1\Assets\IronSource\Scripts\IronSource.cs:242
    27.   at IronSourceDemoScript.OnGUI () [0x001d4] in C:\unityProjects\test1\Assets\IronSource\DemoScene\IronSourceDemoScript.cs:188
    28.  
    29.  
     
  13. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    Do you guys have any suggestions?

    I see other people are having different issues as well with artifacts, is there a happy path you guys have tested on where a particular version of unity works with even the demo project? It does seem that unity apps are currently unable to be monetized with ads, I can create my project on any version, I just need to know what actually works?
     
  14. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    I manually downloaded mediationsdk-7.2.7.aar, is there a way I can manually add this to my project? Will that solve my issue?
     
  15. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    I just spent the evening trying to get the demo project working with these instructions
    https://developers.is.com/ironsource-mobile/unity/unity-plugin/#step-1
    These dont seem to be the complete steps, Im back to the error with
    Code (CSharp):
    1. Could not find com.ironsource.sdk:mediationsdk:7.2.7.
    And commenting out the mavenlocal and jcenter repos are not fixing the issue this time.
    Where should I expect these jars to be once fetched, are they wrapped up in
    Code (CSharp):
    1.  unityLibrary\libs\unity-classes.jar
    or do they sit along side it here.

    This is a new project with just the demo sample in it, its using the mobile 2d template from unity hub, I dont think these instructions are complete.
     
  16. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    I solved this issue and got the Demo project working.
    In order to do this I had to find my settings.gradle file as per here
    https://docs.unity3d.com/2022.2/Documentation/Manual/android-gradle-overview.html

    I then commented out the dependencyResolutionManagement section
    I'm not sure why I need to do this, is it because the demoproject is fetching from a repo that my actual unity project ?
    Is this an ok change to make, what would be the repercussions of this for example?

    If this is correct or there is some other fix, I think it should be included in the docs as its not obvious from them ( at least to me, unless I've missed something, and that could happen!) that I should do this.
     
  17. jcGrenier

    jcGrenier

    Unity Technologies

    Joined:
    Feb 23, 2021
    Posts:
    145
    It's a bit hard to figure what your particular issue is from partial data.
    The error you are getting
    Code (CSharp):
    1. java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/InitializationListener;
    indicates you are missing some of the android libraries.

    That particular dependency should be defined in IronSourceSDKDependencies.xml, which should be in your Assets/IronSource/Editor folder.
    Depending on your settings, when resolving your dependencies, you should download the library in a plugins folder, or add it to a mainTemplate.gradle file, the entry should look something like
    Code (CSharp):
    1. implementation 'com.ironsource.sdk:mediationsdk:7.2.6' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:9
    I do not recommend making manual changes unless you are very familiar with dependency resolution/gradle.

    From a blank project, the process should be as follows:
    - install the package
    - install a dependency resolver (a popup will offer one if you don't have one installed)
    - open the integration manager from the top menu if you want to update to the latest version or install other adapters.
    - go to your dependency manager menu and resolve your dependencies (and verify that they are there, no error occured etc)
    - build with the demo scene.
     
  18. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    1. Does this work for you out of the box, these dont seem to be all the steps for me.
    I had to add make changes to gradleTemplate.properties file, where the docs dosent call it out as something I need to even generate manually?

    2. When you say blank project, are you using mobile template from unity hub?

    3. These issue seem to be dependecy in nature,
    Code (CSharp):
    1. ee https://docs.gradle.org/7.2/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories for details.
    2.    > Could not find com.ironsource.sdk:mediationsdk:7.2.6.
    3.      Searched in the following locations:
    4.        - https://dl.google.com/dl/android/maven2/com/ironsource/sdk/mediationsdk/7.2.6/mediationsdk-7.2.6.pom
    5.        - https://repo.maven.apache.org/maven2/com/ironsource/sdk/mediationsdk/7.2.6/mediationsdk-7.2.6.pom
    6.        - file:/C:/unityProjects/test1/test2/unityLibrary/libs/mediationsdk-7.2.6.jar
    7.        - file:/C:/unityProjects/test1/test2/unityLibrary/libs/mediationsdk.jar
    Unless Im mistaken, those repos are been overwritten here by default
    Code (CSharp):
    1. dependencyResolutionManagement {
    2.     repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    3.     repositories {
    4.         **ARTIFACTORYREPOSITORY**
    5.         google()
    6.         mavenCentral()
    7.         flatDir {
    8.             dirs "${project(':unityLibrary').projectDir}/libs"
    9.         }
    10.     }
    11. }
    What Ive done is commented that out, and I think that tells gradle to fetch from the
    https://android-sdk.is.com/ repo, which as far as I can tell is not been searched in (at least according to the error message).

    4. I wonder is there be some other global place that I may have made a change to unity where it would ignore project repositories for all projects I create?
    Thanks for your help.
     
  19. rbitard

    rbitard

    Joined:
    Jan 11, 2022
    Posts:
    197
    edit: I ditched Ironsource, too much problems, too low ecpm
    I have the same bug is it still the recommended approach ?
     
    Last edited: Sep 24, 2023
    PsijicNine likes this.
  20. victornor

    victornor

    Joined:
    Jan 17, 2014
    Posts:
    87
    Can we just have a public solution to this, that does not depend on some support staff changing backend flags?
    Test ads work fine on non-live ironsource app. Selecting live app when creating an app makes it unable to fetch ads.

    2023/11/21 02:05:11.822 3258 3319 Error ironSourceSDK API: No interstitial configurations found
    2023/11/21 02:05:11.832 3258 3319 Error Unity System.Exception: Interstitial - the server response does not contain interstitial data

    This is test mode. There should not be some random hidden requirements...

    Please unity...
     
  21. toan-stt

    toan-stt

    Joined:
    Sep 30, 2013
    Posts:
    11
    I have the same problem
     
  22. vagelis199

    vagelis199

    Joined:
    Jul 27, 2012
    Posts:
    179
    I have this issue after updating the iron source sdk
    Code (CSharp):
    1. 2024/01/15 23:48:14.679 19651 19676 Error Unity setUnityInitializationListener method doesn't exist, error: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/InitializationListener;
    2. 2024/01/15 23:48:14.679 19651 19676 Error Unity IronSourceEvents:Awake()
    3. 2024/01/15 23:48:14.679 19651 19676 Error Unity UnityEngine.GameObject:.ctor(String, Type[])
    4. 2024/01/15 23:48:14.679 19651 19676 Error Unity IronSource:.ctor()
    5. 2024/01/15 23:48:14.679 19651 19676 Error Unity IronSource:get_Agent()
    6. 2024/01/15 23:48:14.679 19651 19676 Error Unity IronSourceInitilizer:Initilize()
    7.  
     
  23. xLeo

    xLeo

    Joined:
    Sep 21, 2010
    Posts:
    191
    Same issue here.

    Using SDK v7.7.0 and Unity 2022.3.18f1
     
  24. sfilo

    sfilo

    Joined:
    Oct 23, 2012
    Posts:
    30
    Same here!

    SDK v7.7.0 and Unity 2021.3.18f1 & 2021.3.35f1 Apple Silicon
     
    Last edited: Feb 16, 2024
  25. Alixff2023

    Alixff2023

    Joined:
    Dec 14, 2023
    Posts:
    13
    Jar not found issue is contiuing with IronSource 7.7.0 and Unity 2022.3.19f1
     
  26. jacobfdunbar

    jacobfdunbar

    Joined:
    Jun 25, 2015
    Posts:
    16
    I've managed to get it working with adapter version 7.7.0 and Unity 2022.3.19f1. My setup is as follows:
    • Install the Ads Mediation package.
      • DO NOT install the Mobile Dependency Manager if prompted. If you already have it, delete the files in "Assets/Editor/"
    • Update the IronSource integration to the latest (7.7.0)
      • Ads Mediation > Integration Manager click "Update" to the right of "ironSource".
    • Install the External Dependency Manager if needed.
    • Configure the External Dependency Manager.
      • In Assets > External Dependency Manager > Android Resolver > Settings...
        • I've enabled "Auto-Resolution" and "Resolution on Build".
        • Patching for "AndroidManifest.xml", "mainTemplate.gradle", and "gradleTemplate.properties" are all enabled.
    • Configure build publishing settings.
      • In Edit > Project Settings > Player > Android > Publishing Settings enable all of the following:
        • "Custom Main Manifest"
        • "Custom Main Gradle Template"
        • "Custom Gradle Properties Template"
        • "Custom Gradle Settings Template"
      • In "Assets/Plugins/Android"...
        • The "gradleTemplate.properties" file should have the following:
          • android.useAndroidX=true
          • android.enableJetifier=true
    Also make sure your phone has internet and access to the ad servers... it took me a while to realize ad requests were being blocked by my local Pi-hole.

    @Alixff2023 @sfilo
     
    Last edited: Feb 15, 2024
    bukerbes1 and Alixff2023 like this.
  27. Jaap_2a

    Jaap_2a

    Joined:
    Nov 20, 2014
    Posts:
    3
    I am trying your set up but after I install the external Dependency Manager...Errors. Any ideas? The advertisement takes ages to get it working....
    Assembly 'Packages/com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.179/Google.IOSResolver.dll' will not be loaded due to errors:
    Unable to resolve reference 'UnityEditor.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform?
    Reference validation can be disabled in the Plugin Inspector.
     
  28. jacobfdunbar

    jacobfdunbar

    Joined:
    Jun 25, 2015
    Posts:
    16
    You need to add iOS build support to the Unity editor version you are using.
     
    Jaap_2a likes this.
  29. sfilo

    sfilo

    Joined:
    Oct 23, 2012
    Posts:
    30
    I was beginning to loose my mind, thanks @jacobfdunbar for sharing!

    I followed your exact steps and it finally worked but only after:
    - updating to unity 2022.3.20 ( I was on 2021.3.35 )
    - installing the External Dependency Manager manually ( unity package didn't work )
     
    Jaap_2a likes this.
  30. Jaap_2a

    Jaap_2a

    Joined:
    Nov 20, 2014
    Posts:
    3
    Pfff, what a hassle with IronSource! I don't get the feeling that it's a priority for IronSource/Unity to ensure developers can easily integrate advertisements. I'm starting to get an Adobe deja vu from Unity now. Turning a cool product into a profit machine with buggy software and frustrated fans. My setup is also version 2022.3.19f1 and, very importantly, install the Dependency Manager in this way:
    Install via Package Manager
    Please follow the instrustions:

    open Edit/Project Settings/Package Manager
    add a new Scoped Registry (or edit the existing OpenUPM entry)
    Name: package.openupm.com
    URL: https://package.openupm.com
    Scope(s): com.google.external-dependency-manager
    click Save or Apply
    open Window/Package Manager
    click +
    select Add package by name... or Add package from git URL...
    paste com.google.external-dependency-manager into name
    paste 1.2.179 into version
    click Add

    Alternatively, merge the snippet to Packages/manifest.json

    {
    "scopedRegistries": [
    {
    "name": "package.openupm.com",
    "url": "https://package.openupm.com",
    "scopes": [
    "com.google.external-dependency-manager"
    ]
    }
    ],
    "dependencies": {
    "com.google.external-dependency-manager": "1.2.179"
    }
    }
     
    Last edited: Feb 18, 2024
    xLeo likes this.
  31. farvind_unity

    farvind_unity

    Joined:
    Feb 2, 2024
    Posts:
    2

    This Worked for me
     
    Jaap_2a likes this.
  32. vlasenkoalexey

    vlasenkoalexey

    Joined:
    Jun 10, 2023
    Posts:
    6
    Spent ridiculous time trying to get ads working for my project.
    For me it boiled down to completely cleaning up old dependency manager installed with Ads Mediation package on my previous installation attempt and also installing Android SDK 33 as described here: https://vraulet.medium.com/a-failure-occurred-while-executing-checkaarmetadataworkaction-7481c7c0609 (in addition to steps described in this thread).

    For iOS I also have to do this hack: https://forum.unity.com/threads/project-wont-build-using-xode15-release-candidate.1491761/page-2

    Surprising how much time it takes to setup Ads in Unity, given that its main source of monetization for majority of game developers, this should be much more straightforward.
     
    xLeo likes this.
  33. bukerbes1

    bukerbes1

    Joined:
    Jan 19, 2024
    Posts:
    1
    Thank you, this is worked