Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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:
    143
    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:
    143
    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:
    189
    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.