DefVideoAds (plugin for Unity ADS). Video ADS native extension

Here is a pre-release build Release 4.0.2 · AGulev/DefVideoAds · GitHub that works fine with Defold 1.2.185 and build-stage.defold.com

1 Like

Could somebody check if DefVideoAds works on Android? (New build in 1.2.185)
Yesterday I found I can’t init the NE, but it was deep night, so I’m not sure if it’s a problem on my side or an issue in the NE + new extender server 1.2.185

Hm, strange if I use UnitySDK 3.7.4 or newer for Android then it doesn’t work.

I get an error when try to initialise SDK.
Log:
unity.txt (71.8 KB)
I think it somehow related to:

Rejecting re-init on previously-failed class java.lang.Class<com.unity3d.services.ads.gmascar.handlers.
                            WebViewErrorHandler>

java.lang.NoClassDefFoundError: com.unity3d.services.ads.gmascar.handlers.WebViewErrorHandler
                         W      at com.unity3d.services.ads.gmascar.GMAScarAdapterBridge.<init>(GMAScarAdapterBridge.java:43)
                         W      at com.unity3d.services.ads.api.GMAScar.<clinit>(GMAScar.java:12)
                         W      at java.lang.reflect.Method.invoke(Native Method)
                         W      at com.unity3d.services.core.webview.bridge.WebViewBridge.handleInvocation(WebViewBridge.java:121)
                         W      at com.unity3d.services.core.webview.bridge.Invocation.nextInvocation(Invocation.java:52)
                         W      at com.unity3d.services.core.webview.bridge.WebViewBridgeInterface.handleInvocation(WebViewBridgeIn
                            terface.java:29)
                         W      at android.os.MessageQueue.nativePollOnce(Native Method)
                         W      at android.os.MessageQueue.next(MessageQueue.java:328)
                         W      at android.os.Looper.loop(Looper.java:164)
                         W      at android.os.HandlerThread.run(HandlerThread.java:61)

Changes they made in 3.7.4.

@britzl maybe you see something I missed here?

Yes, maybe. It looks like there’s Java reflection happening and that some classes aren’t present. I think you may have to add aaptExtraPackages to your ext.manifest to ensure those classes are included:

platforms:
    android:
        context:
            aaptExtraPackages: ['com.unity3d.services.ads.gmascar', 'com.unity3d.services.ads.gmascar.bridges']

There is also “gmascar.finders” and “gmascar.adapters” but it looks like it’s only “bridges” that you need to add.

1 Like

hm, no it doesn’t help :frowning:

build-log.txt (14.1 KB)

UPD: maybe it’s something on their side because I don’t get why it tries to use GMA if I use only unity ads itself

Not sure but it seems like this fix helped:

I updated the extension with the latest Android SDK and it works fine now (without aaptExtraPackages)

3 Likes

@AGulev
I have been using 3.7.2 for a while, and was hoping to update to 4.x.

I see the breaking changes in the callback, and was hoping you could tell me something: when there are errors, such as EVENT_SDK_ERROR, is message.placement_id still available? Looking at the new Java code, I’m not sure.

Previously I was able to detect when a placement failed to load or was unavailable, and want to ensure I can still do that. In particular, this is handy for rewarded video ads, so I can update the GUI button to show an error state when necessary.

4 Likes

It totaly makes sense. I added placement_id in the latest release https://github.com/AGulev/DefVideoAds/releases/tag/4.0.5

4 Likes

Thank you for the quick update! I’ll hopefully be able to test the new version later today.

1 Like

Gave this a spin now and it spits back this when bundling for Android:

/defunityads/src/java/com/agulev/defunityads/DefUnityAdsJNI.java
	Line 392: local variable placementId is accessed from within inner class; needs to be declared final
                    sendSimpleMessage(MSG_BANNER, EVENT_SDK_ERROR, "code", code,"error", errorInfo.errorMessage, "placement_id", placementId);
                                                                                                                             ^

Bundled fine for iOS though.

hm, sorry for that. This is strange I can build it without any issues (as well as CI). ppbly you use older Defold version or something like that.
Pls check the latest version

1 Like

Very probably - I’m still on 1.2.184. Thanks for looking at this so quickly, superstar!

Going to try bundling again, will report back. Update: Built like a dream. :ok_hand:

2 Likes

The latest version works great for me so far. Releasing to production, so hopefully no hidden issues.

I am 98% confident that I updated my callback function properly :smile:

2 Likes

A post was merged into an existing topic: Defold 1.2.188 has been released

Unity SDK update to version 4.0.0

Attention deprecated API methods removed

  • is_ready() - method deprecated in 3.4.0 and removed now;
  • get_placement_state() - method deprecated in 3.4.0 and removed now;
  • optional parameter enable_per_placement_load for initialize()- now it’s always true by default.
4 Likes

i think it’s something on their side because I don’t get why it tries to use GMA if I use only unity ads itself

looking for more info on it.. ..

you are looking for more info about what? I don’t get what the question is.

On Android, in landscape orientation, ads immediately rotate to portrait and then back to landscape. Do you know why this happens?
Video attached - it’s very short so you may have to watch it a few times.

I don’t know, to be honest.
Is it the same when you watch real ads (not test ads)?