Not working Advertisements

Hello, there is a problem with Advertisements 3.4.7 from Package Manager
Unity version: 2019.2.6f1
When starting the project, a message appears in the console:

E/Unity: java.lang.ClassNotFoundException: Didn't find class "com/unity3d/services/banners/IUnityBannerListener"

After that the plugin is not initialized

Could you try removing the package and instead try adding it via the services tab. If that doesn’t fix your problem could you post up your ads code?

As I know, in plugin version from services tab not avalivle IUnityAdsListener and banners

Hey @DeniShed could you post a screenshot of the full error you’re getting? Is it happening on project launch or when you press play?

I export a project from Unity and build it using Android Studio. When launching a project, at the stage of Advertisements initialization, this error appears.

2020-08-11 15:18:57.483 8395-8442/? E/Unity: java.lang.ClassNotFoundException: Didn't find class "com/unity3d/services/banners/IUnityBannerListener" on path: DexPathList[[zip file "/data/app/biz.company.test.biz.company.test-je-UuxYUAUE3HFsqJvq8-w==/base.apk"],nativeLibraryDirectories=[/data/app/biz.company.test.biz.company.test-je-UuxYUAUE3HFsqJvq8-w==/lib/arm64, /data/app/biz.company.test.biz.company.test-je-UuxYUAUE3HFsqJvq8-w==/base.apk!/lib/arm64-v8a, /system/lib64]]

6191625--678948--Снимок.PNG

Ahh I see, so this error is in Android Studio. It sounds like the SDK isn’t being pulled into the Android project properly. Does it only happen with 3.4.7?

On all versions above 2.0.8

Most of our Android developers build directly from Unity rather than export to Android Studio so I’m unfortunately not familiar with the specifics of what happens with the SDK in this case.

Can you open a support ticket by emailing the information above along with any other relevant project details to unityads-support@unity3d.com? We can then look into this properly for you.

So this is an interesting error. Can you confirm how you installed the unity ads sdk, via package manager or the asset store? Can you confirm if things are working for you in editor playmode and you are able to see the placeholder images?

I have tried both plugin options from package manager and from asset store. The results are the same. In editor playmode appears placeholder and everything works.

I also use Grandle for assembly, maybe the problem is somewhere there…

So I just re-read through the thread, and this very much looks related to the custom gradle build process your running. Likely you just need to add a reference to the UnityAds.aar in to your build steps so that it gets linked in during the build and is available at runtime.

Problem solved. On the old plugin version (Unity Ads 2.0.8) his name is “unity-ads.aar”. New version - “UnityAds.aar”. In gradle file i change implementation strings.
From

implementation(name: 'unity-ads, ext:'aar')

To

implementation(name: 'UnityAds', ext:'aar')
implementation(name: 'UnityAdsAndroidPlugin', ext:'aar')

And now advertising is working.Thanks everyone for the help)

1 Like