Edit : I solved the problem by just upgrading the minimum SDK version. I thought at first i shouldn’t do that because it will impact lower-end mobiles.
Hi everybody,
So i’ve spent the last day trying to make IronSource work, encountering all sorts of bugs and problems. Finally, i thought it was done when the demo finally worked without any problem.
But when i tried to integrate ironsource into my own code/project, it gave me the following error. While the demo wasn’t working, i still had some ideas on what to try and fiddle with, but now that the demo is working but not the code, i don’t have the slightest idea of what to do.
The error shows in the console. The build works.
Here is the error
"
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime FATAL EXCEPTION: main
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime Process: com.DefaultCompany.Myproject, PID: 30644
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/webkit/WebViewFeature;
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at com.unity3d.services.core.webview.WebView.(WebView.kt:83)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at com.unity3d.services.core.webview.WebViewApp.(WebViewApp.java:63)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at com.unity3d.services.core.webview.WebViewApp.(WebViewApp.java:49)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at com.unity3d.services.core.webview.WebViewApp.(WebViewApp.java:33)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at com.unity3d.services.core.webview.WebViewApp$1.run(WebViewApp.java:312)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at android.os.Handler.handleCallback(Handler.java:942)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:99)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at android.os.Looper.loopOnce(Looper.java:226)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at android.os.Looper.loop(Looper.java:313)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:8757)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at java.lang.reflect.Method.invoke(Native Method)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
2023/09/28 12:10:39.412 30644 30644 Error AndroidRuntime Caused by: java.lang.ClassNotFoundException: androidx.webkit.WebViewFeature
"
I had to delete Webkit and some other librairies shown above because they gave me an error “requires ‘compileSdkVersion’ to be set to 33 or higher.”
"
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:launcher:checkReleaseAarMetadata’.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
One or more issues found when checking AAR metadata values:
Dependency ‘:androidx.annotation.annotation-experimental-1.3.0:’ requires ‘compileSdkVersion’ to be set to 33 or higher.
Compilation target for module ‘:launcher’ is ‘android-32’
Dependency ‘:androidx.core.core-1.9.0:’ requires ‘compileSdkVersion’ to be set to 33 or higher.
Compilation target for module ‘:launcher’ is ‘android-32’
Dependency ‘:androidx.core.core-ktx-1.9.0:’ requires ‘compileSdkVersion’ to be set to 33 or higher.
Compilation target for module ‘:launcher’ is ‘android-32’
Dependency ‘:androidx.webkit.webkit-1.6.1:’ requires ‘compileSdkVersion’ to be set to 33 or higher.
Compilation target for module ‘:launcher’ is ‘android-32’
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights."
Here is the code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class LevelPlay : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
string appKey = "1111111";
IronSource.Agent.init(appKey);
IronSource.Agent.validateIntegration();
Debug.Log("unity-script: IronSource.Agent.init");
}
// Update is called once per frame
private void onEnable()
{
IronSourceInterstitialEvents.onAdReadyEvent += InterstitialOnAdReadyEvent;
IronSourceInterstitialEvents.onAdLoadFailedEvent += InterstitialOnAdLoadFailed;
IronSourceInterstitialEvents.onAdOpenedEvent += InterstitialOnAdOpenedEvent;
IronSourceInterstitialEvents.onAdClickedEvent += InterstitialOnAdClickedEvent;
IronSourceInterstitialEvents.onAdShowSucceededEvent += InterstitialOnAdShowSucceededEvent;
IronSourceInterstitialEvents.onAdShowFailedEvent += InterstitialOnAdShowFailedEvent;
IronSourceInterstitialEvents.onAdClosedEvent += InterstitialOnAdClosedEvent;
}
void OnApplicationPause(bool isPaused)
{
}
public void LoadFullAd()
{
IronSource.Agent.loadInterstitial();
}
public void destroyFullAd()
{
}
public void showFullAd()
{
if (IronSource.Agent.isInterstitialReady())
{
IronSource.Agent.showInterstitial();
}
else
{
Debug.Log("Bug Show : AD NOT READY");
}
}
public void LoadBanner()
{
}
public void DestroyBanner()
{
}
/************* Interstitial AdInfo Delegates *************/
// Invoked when the interstitial ad was loaded succesfully.
void InterstitialOnAdReadyEvent(IronSourceAdInfo adInfo)
{
}
// Invoked when the initialization process has failed.
void InterstitialOnAdLoadFailed(IronSourceError ironSourceError)
{
Debug.Log("Ad initialization failed");
}
// Invoked when the Interstitial Ad Unit has opened. This is the impression indication.
void InterstitialOnAdOpenedEvent(IronSourceAdInfo adInfo)
{
}
// Invoked when end user clicked on the interstitial ad
void InterstitialOnAdClickedEvent(IronSourceAdInfo adInfo)
{
}
// Invoked when the ad failed to show.
void InterstitialOnAdShowFailedEvent(IronSourceError ironSourceError, IronSourceAdInfo adInfo)
{
Debug.Log("Ad initialization failed other bug");
}
// Invoked when the interstitial ad closed and the user went back to the application screen.
void InterstitialOnAdClosedEvent(IronSourceAdInfo adInfo)
{
}
// Invoked before the interstitial ad was opened, and before the InterstitialOnAdOpenedEvent is reported.
// This callback is not supported by all networks, and we recommend using it only if
// it's supported by all networks you included in your build.
void InterstitialOnAdShowSucceededEvent(IronSourceAdInfo adInfo)
{
}
}
The code is just linked to two buttons prompting the LoadFullAd and ShowFullAd functions.
The build setting is exactly the same for the ironsource demo project and mine, so the problem can’t be there.
And an idea of where my project (first image) and iron source are stored.




