After wasting countless development hours trying to make it work as well as looking up several similar complaints from others (especially non experienced developers), I have concluded that it’s virtually impossible to set up Ironsource’s Levelplay using following just the instructions on their website and what’s available on Unity Docs
It seems that only those well experienced in the art of gradle mortal combat can surmount countless gradle errors to have it work and show ads. It also seems that most of the problems center around External Dependency Resolver not properly resolving the required files.
Current Setup
Import Ironsource SDK on a blank project
Enable both custom gradle property and custom main gradle template options in publishing settings (There would dependency resolution errors if this is not done)
add this to gradle.properties file (there would be compilation errors if this is not done )
android.useAndroidX=true
android.enableJetifier=true
Dependency resolver > resolve
Dependency resolver > delete resolved libraries (I get various build errors if I don’t do this)
build
The project builds successfully but sample ads don’t show. On Logcat, I get this error
Autoconnected Player “Autoconnected Player” AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/InitializationListener;
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/InitializationListener
;
2 Likes
valonsoft:
After wasting countless development hours trying to make it work as well as looking up several similar complaints from others (especially non experienced developers), I have concluded that it’s virtually impossible to set up Ironsource’s Levelplay using following just the instructions on their website and what’s available on Unity Docs
It seems that only those well experienced in the art of gradle mortal combat can surmount countless gradle errors to have it work and show ads. It also seems that most of the problems center around External Dependency Resolver not properly resolving the required files.
Current Setup
Import Ironsource SDK on a blank project
Enable both custom gradle property and custom main gradle template options in publishing settings (There would dependency resolution errors if this is not done)
add this to gradle.properties file (there would be compilation errors if this is not done )
android.useAndroidX=true
android.enableJetifier=true
Dependency resolver > resolve
Dependency resolver > delete resolved libraries (I get various build errors if I don’t do this)
build
The project builds successfully but sample ads don’t show. On Logcat, I get this error
Autoconnected Player “Autoconnected Player” AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/InitializationListener;
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/ironsource/mediationsdk/sdk/InitializationListener
;
Please anyone that has gotten Unity level play to work should please post some pointers — especially on external dependency resolver settings
I’ve got it working eventually on Android, so I feel somewhat blessed. We’re just using rewarded video. I went back, in detail, through the setup here, including the link to Unity integration. I did not setup server to server callbacks.
The final step before it started working was to setup the app-ads.txt file on our website, which is the site configured in Google Play for our app under Store Settings / Store Listing Contact Details. I’m not sure if this was critical or not.
However, I am still waiting to receive a Publisher Account ID to include in this file, so have commented out the IronSource line for now.
Find an ads.txt validator online to iron out problems in the file.
I am also still waiting for account approval, so cannot go live with the update.
I never saw the error that you have so cannot give advice on that specifically.
It would be better for you to contact the dedicated Unity LevelPlay support team for your LevelPlay-related questions.
If you are having problems getting your LevelPlay advertisements to display I would recommend you consult the LevelPlay FAQ here: https://developers.is.com/ironsource-mobile/unity/troubleshooting-dont-see-ads-app/
If you are having other issues relating to LevelPlay, you can reach out to their support team here: knowledge center New 2022
I have finally solved this problem. The main issue is that the Gradle installation that comes with Unity 2022.2 has some bugs that prevents Ironsource from compiling successfully by default (I don’t know whether android.enabledR8 errors have been fixed with Unity 2021 LTS though). I got it to work using the instructions here: [Bug] Android Gradle project repositories block don't work for the latest Unity versions · Issue #594 · googlesamples/unity-jar-resolver · GitHub
I would be creating another thread later to explain the steps I took to solve these problems — at least that would be helpful to newbies
1 Like
valonsoft:
I have finally solved this problem. The main issue is that the Gradle installation that comes with Unity 2022.2 has some bugs that prevents Ironsource from compiling successfully by default (I don’t know whether android.enabledR8 errors have been fixed with Unity 2021 LTS though). I got it to work using the instructions here: https://github.com/googlesamples/unity-jar-resolver/issues/594
I would be creating another thread later to explain the steps I took to solve these problems — at least that would be helpful to newbies
Hi could you please add the link to the thread where you explained the steps?
Also, how could I check if 2020.3 LTS is good or corrupted with regards to this issue ?
valonsoft:
I’m wasting countless hours on making some Levelplay adapters works (unityAdsSDK for example)
Did you have any problems or did you do something about that ?
I think Dependency resolver has fixed this issue, so the latest one should work. Someone please confirm
googlesamples:master
← 256p:master
opened 02:54PM - 29 Mar 23 UTC
This PR fixes https://github.com/googlesamples/unity-jar-resolver/issues/594#iss… ue-1553387077
Changes influence only builds when main Gradle template patching is enabled.
Changes:
* Added "Patch settingsTemplate.gradle" checkbox in Android Resolver settings.
* Implemented repositories injection in `settingsTemplate.gradle`
* Added `/resolve/gradlesettingstemplate` report URL to the analytics. (Not sure if it is needed)
The logic of repositories injection depends on the project state:
* Project state when `mainTemplate.gradle` and `settingsTemplate.gradle` are enabled and mainTemplate patching and settingsTemplate patching in Android Resolver settings are enabled:
1. Android Resolver will check if `settingsTemplate.gradle` contains `dependencyResolutionManagement` block with `RepositoriesMode.PREFER_SETTINGS` or `RepositoriesMode.FAIL_ON_PROJECT_REPOS`. If the match is successful it would mean that Gradle is configured to read repositories from `settingsTemplate.gradle` and will not read repositories specified in `mainTemplate.gradle`.
2. If the previous check is successful then Android Resolver will inject repositories in `settingsTemplate.gradle` before `dependencyResolutionManagement` line. Injected repositories are in separate `dependencyResolutionManagement` block and look like this:
```
// Android Resolver Repos Start
dependencyResolutionManagement {
repositories {
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
maven {
url "https://maven.google.com"
}
maven {
url "https://maven.google.com/" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7, Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:12, Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:17, Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
}
mavenLocal()
mavenCentral()
}
}
// Android Resolver Repos End
```
3. If the previous check isn't successful then Android Resolver will inject repositories the same way as it is doing in older versions in `mainTemplate.gradle`
* In the project state when `mainTemplate.gradle` and `settingsTemplate.gradle` are enabled and mainTemplate patching is **enabled** but settingsTemplate patching in Android Resolver settings is **disabled**, Android Resolver will not patch `settingsTemplate.gradle` this will lead to the build fail and the user will need to manage repositories manually.
* Project state when `mainTemplate.gradle` is enabled and mainTemplate patching and settingsTemplate patching in Android Resolver settings are enabled but `settingsTemplate.gradle` is disabled:
1. If the Unity version is equal to or above 2022.2.10 Android Resolver will fail and in the error log will be asked to enable the settings template in "Project Settings".
2. If the Unity version is below 2022.2.10 then Android Resolver will check if the default `settingsTemplate.gradle` in `PlaybackEngines/AndroidPlayer/Tools/GradleTemplates` contains `dependencyResolutionManagement` block. Effectively this will match any Unity version equal to or above the 2022.2 version because `dependencyResolutionManagement` was introduced in the 2022.2 version.
2.1. If the previous check didn't match then Android Resolver will work as in the previous versions.
2.2. If the previous check is successful then Android Resolver will enable `settingsTemplate.gradle` automatically (by copying the default template). Decided to do it in such a way because Unity >=2022.2 and <2022.2.10 uses a settings template for repositories but don't have an option in "Project Settings" to enable a custom settings template. This option appeared only in 2022.2.10.
First check whether the test ads work or not
I’ve done a ton of things including copying the resolver from ironsource demo project
mvdevp
April 15, 2023, 1:24am
11
it worked for me, thanks.
now demo ads working