MobiVM / robovm-robopods

55 stars 37 forks source link

AdMob Native ads are not working #84

Closed lukz closed 3 years ago

lukz commented 5 years ago

Hi!

I'm successfully using Google Mobile Ads robopod for banner, interstitial and rewarded ads.

While trying to set up native ads with:

NSMutableArray<GADAdLoaderOptions> optionsArray = new NSMutableArray<>();
optionsArray.add(videoOptions);

List <GADAdLoaderAdType> adTypes = new ArrayList<>();
adTypes.add(GADAdLoaderAdType.UnifiedNative);

adLoader = new GADAdLoader(TEST_ID, rootViewController, adTypes, optionsArray);

I get an error:

java.lang.Error: java.lang.reflect.InvocationTargetException
    at org.robovm.rt.bro.LazyGlobalValue.value(LazyGlobalValue.java:95)
    at org.robovm.apple.foundation.GlobalValueEnumeration.value(GlobalValueEnumeration.java:29)
    at org.robovm.pods.google.mobileads.GADAdLoaderAdType$AsListMarshaler.toNative(GADAdLoaderAdType.java:85)
    at org.robovm.pods.google.mobileads.GADAdLoader.$m$initWithAdUnitID$rootViewController$adTypes$options$(Native Method)
    at org.robovm.pods.google.mobileads.GADAdLoader.init(GADAdLoader.java)
    at org.robovm.pods.google.mobileads.GADAdLoader.<init>(GADAdLoader.java:52)
    at com.match.three.game.IOSNativeAds.updateLoader(IOSNativeAds.java:48)
    at com.teskin.NativeAd.updateLoader(NativeAd.java:72)
    at com.match.three.game.screens.NewMenuScreen.init(NewMenuScreen.java:147)
    at com.match.three.game.screens.NewMenuScreen.prepare(NewMenuScreen.java:59)
    at com.match.three.game.asset.MetaAssets.init(MetaAssets.java:14)
    at com.match.three.game.screen.splash.SplashScreen.onLevelsProgressLoaded(SplashScreen.java:36)
    at com.match.three.game.screen.splash.SplashScreen.render(SplashScreen.java:57)
    at com.badlogic.gdx.Game.render(Game.java:46)
    at com.badlogic.gdx.backends.iosrobovm.IOSGraphics.draw(IOSGraphics.java:354)
    at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.draw(IOSGraphics.java:229)
    at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.$cb$drawRect$(IOSGraphics.java)
    at org.robovm.apple.uikit.UIApplication.main(Native Method)
    at org.robovm.apple.uikit.UIApplication.main(UIApplication.java:428)
    at com.match.three.game.IOSLauncher.main(IOSLauncher.java:33)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.internalInvoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:591)
    at org.robovm.rt.bro.LazyGlobalValue.value(LazyGlobalValue.java:89)
    ... 19 more
Caused by: java.lang.UnsatisfiedLinkError: Optional @GlobalValue method org/robovm/pods/google/mobileads/GADAdLoaderAdType$Values.UnifiedNative()Lorg/robovm/apple/foundation/NSString; not bound
    at org.robovm.pods.google.mobileads.GADAdLoaderAdType$Values.UnifiedNative(Native Method)
    ... 22 more

It looks like the problem is related to passing GADAdLoaderAdType's list to the GADAdLoader constructor.

I've tried few different admob framework versions with the same results.

Is it a robopod bug or am I doing something wrong?

Google mobile ads framework: 7.31.0 Robopods: 2.2.3-SNAPSHOT RoboVM: 2.3.7

obigu commented 5 years ago

I guess you're the first person to integrate native ads :).

You can try https://github.com/MobiVM/robovm-robopods/pull/77. You'll need to build it locally and ideally depend on 7.42.2.

lukz commented 5 years ago

This is what I thought ;)

I'll try it and let you know if it works, thanks!

obigu commented 4 years ago

Any updates on this?

lukz commented 4 years ago

We decided to postpone native ads implementation and didn't come back to it yet.