[iOS & Android] AdMob Extension [2.1] [DEPRECATED]

masai2k

  • Posts: 65
Hi,
I installed this extension but the compiler give me an error:

[LOG]       [dex] input: C:\Users\Massimo\AppData\Roaming\Stencyl\stencylworks\games-generated\staggisti27122013\Export\android\bin\bin\classes
[LOG]       [dex] input: C:\Users\Massimo\AppData\Roaming\Stencyl\stencylworks\games-generated\staggisti27122013\Export\android\bin\deps\extension-api\bin\classes.jar
[LOG]       [dex] input: C:\Users\Massimo\AppData\Roaming\Stencyl\stencylworks\games-generated\staggisti27122013\Export\android\bin\libs\GoogleAdMobAdsSdk-4.0.3.jar
[LOG]       [dex] input: C:\Users\Massimo\AppData\Roaming\Stencyl\stencylworks\games-generated\staggisti27122013\Export\android\bin\libs\GoogleAdMobAdsSdk-6.4.1.jar
[LOG]       [dex] Pre-Dexing C:\Users\Massimo\AppData\Roaming\Stencyl\stencylworks\games-generated\staggisti27122013\Export\android\bin\deps\extension-api\bin\classes.jar -> classes-3e1749adeeecfeb1294abd33de4fc94d.jar
[LOG]       [dex] Pre-Dexing C:\Users\Massimo\AppData\Roaming\Stencyl\stencylworks\games-generated\staggisti27122013\Export\android\bin\libs\GoogleAdMobAdsSdk-4.0.3.jar -> GoogleAdMobAdsSdk-4.0.3-5c50306a806f035117ca94c97219dbd5.jar
[LOG]       [dex] Pre-Dexing C:\Users\Massimo\AppData\Roaming\Stencyl\stencylworks\games-generated\staggisti27122013\Export\android\bin\libs\GoogleAdMobAdsSdk-6.4.1.jar -> GoogleAdMobAdsSdk-6.4.1-c0e3b9bc068adb8e5fd84455c72ee208.jar
[LOG]       [dex] Converting compiled files and external libraries into C:\Users\Massimo\AppData\Roaming\Stencyl\stencylworks\games-generated\staggisti27122013\Export\android\bin\bin\classes.dex...
[LOG]        [dx] Merged dex A (61 defs/65,5KiB) with dex B (5 defs/5,3KiB). Result is 66 defs/82,4KiB. Took 0,1s
[LOG]        [dx] Merged dex A (66 defs/82,4KiB) with dex B (171 defs/158,1KiB). Result is 237 defs/286,2KiB. Took 0,3s
[LOG]        [dx]
[LOG]        [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[LOG]        [dx] com.android.dex.DexException: Multiple dex files define Lcom/google/ads/Ad;
[LOG]        [dx]    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:593)
[LOG]        [dx]    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:551)
[LOG]        [dx]    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:532)
[LOG]        [dx]    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:169)
[LOG]        [dx]    at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
[LOG]        [dx]    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
[LOG]        [dx]    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
[LOG]        [dx]    at com.android.dx.command.dexer.Main.run(Main.java:230)
[LOG]        [dx]    at com.android.dx.command.dexer.Main.main(Main.java:199)
[LOG]        [dx]    at com.android.dx.command.Main.main(Main.java:103)


it try to load 2 different GoogleAdMobAdsSdk, WHY ????


mat0pad

  • Posts: 364
Have anyone tried supplementing iAd placement with AdMob? Say you use iAd but if it doesn't load then you switch to Admob. I very interested because I currently lose a lot of renveue since iAd is only supported in few countries.

« Last Edit: December 31, 2013, 03:43:49 am by mat0pad »
   


                              

Abliblablobla

  • *
  • Posts: 524
Hi everyone,

I'm sorry, but I didn't have time for Stencyl recently since I'm a student and in this time of the year I have to study for mid-term exams.

@kuroi
I cannot think of a better way to implement AdMob as of now... From what I understand, you see "major lags" when using the "show admob normal banner..." block on low-end devices such as an Xperia J. Unfortunately I my lower-end device is an Xperia U which has a 1GH dual core CPU compared to the 800MH single core CPU found in an Xperia J. All I can say is that I didn't see any lag caused by banners when testing a game that I have created months ago (in March/April if I remember correctly) and in this game there were both AdMob banners and Chartboost interstitials. As Jon has already wrote, loading a banner always consumes some CPU, and while it is very hard to notice it on high-end devices, it still exists and it may become a problem when running your game on low-end devices. I don't know if this is obvious, but I give you a small tip: you don't need to use the "show admob..." block every time you change or reload a scene if you are displaying a banner in the previous scene since the banner will be displayed as long as you don't use the "hide admob..." block. Also a banner automatically refreshes its content without using the "show admob..." block again. Hope this helps you!

@Konig Studios
That is strange: I didn't have your problem while testing on iOS 7. Are you able to replicate it with the Extension Test game (you can find it in the first post)?

@mat0pad
As soon as I have some time I will provide a new option for this extension that will let the user show an iAd banner and if it fails to load (iAd unsupported region, iAd network error, iAd runs out of inventory) then it will show an AdMob banner. Hopefully it will be done before the end of February (it doesn't take so much time, but unfortunately I don't have a lot of time in this period).

@masai2k
Try this:
1) First use Run > Clean Project;

2) Then go under YourStencylFolder/plaf/haxe/extensions/ads, open include.nmml and delete these two lines:
         <java path="project/android" />
         <template path="template/android/libs/GoogleAdMobAdsSdk-4.0.3.jar" rename="libs/GoogleAdMobAdsSdk-4.0.3.jar" if="android"/>

3) Return to your game, enable the AdMob extension, close and open your game again (remember to save before closing).

4) Compile your project.

@Jon
In the current version of Stencyl, there still is an outdated version of the AdMob SDK that in some scenarios can lead to compile errors. Could you please remove the old admob extension form the OpenFL version of Stencyl? Thank you!

I am sorry for my late reply. As always let me know if there you experience further issues with this extension!
.: BuruBuru :.

Jon

  • *
  • Posts: 17524
I've just updated the built-in ad "extension" to sync up with your newest version. To keep with what's there, this support is only for Android. Once an auto-fallback mechanism's in place, I can consider including the iOS portion of this too.

Abliblablobla

  • *
  • Posts: 524
I have just updated the AdMob Guide.

New in this version:
 - New chapter: "Tips & Tricks"
 - Smart Banner brief description
 - Small tweaks


As soon as I have some time I will provide a new option for this extension that will let the user show an iAd banner and if it fails to load (iAd unsupported region, iAd network error, iAd runs out of inventory) then it will show an AdMob banner. Hopefully it will be done before the end of February (it doesn't take so much time, but unfortunately I don't have a lot of time in this period).


I think I am not going to do this anymore since mat0pad had a simple yet ingenious idea. I have described the process in the new "Tips & Tricks" section of the AdMob Guide.

If someone wants to proofread my guide, feel free to do it!
.: BuruBuru :.

mGilbee

  • Posts: 26
When I test this on my android device I get this error in the compiler:

[LOG] -compile:
[LOG]     [javac] Compiling 20 source files to /Users/user/stencylworks/games-generated/Free Android Breaker/Export/android/bin/bin/classes
[LOG]     [javac] /Users/user/stencylworks/games-generated/Free Android Breaker/Export/android/bin/src/MyAdmob.java:57: cannot find symbol
[LOG]     [javac] symbol  : variable SMART_BANNER
[LOG]     [javac] location: class com.google.ads.AdSize
[LOG]     [javac]                     adView = new AdView(activity, AdSize.SMART_BANNER, code);
[LOG]     [javac]                                                         ^
[LOG]     [javac] Note: Some input files use or override a deprecated API.
[LOG]     [javac] Note: Recompile with -Xlint:deprecation for details.
[LOG]     [javac] 1 error
[LOG]
[LOG] BUILD FAILED
[LOG] /Users/user/stencylworks/android-sdk/android-sdk-macosx/tools/ant/build.xml:713: The following error occurred while executing this line:
[LOG] /Users/user/stencylworks/android-sdk/android-sdk-macosx/tools/ant/build.xml:727: Compile failed; see the compiler error output for details.

Any ideas? It works fine in the iOS simulator, just not on my android device (HTC Raider).
Breaker for Android My first game Breaker is now out for Android!
Get the free version here

Jon

  • *
  • Posts: 17524
I hit that one when I was integrating the extension. You have to Run > Clean Project to resolve it.

mGilbee

  • Posts: 26
I hit that one when I was integrating the extension. You have to Run > Clean Project to resolve it.

Thanks for the reply. I tried cleaning the project and updating to the latest Stencyl build (mine was about 2-3 weeks old) but I'm still getting the same error. Again it works fine on the iOS simulator, just not on my android device. Any other ideas?  ???
Breaker for Android My first game Breaker is now out for Android!
Get the free version here

Abliblablobla

  • *
  • Posts: 524
Could you post an image of your behavior? Are you able to replicate the issue with the sample game (you can find it in the first post of this thread).
.: BuruBuru :.

GuyCockcroft

  • Posts: 193
I have implemented Admob in one of my apps, and it works a treat. Except in the following case:

Google guidelines state that you are supposed to be able to dismiss dialogue boxes with the "back" button. So, I need to override the normal behaviour. In order to quit the app, I have to add a code block that calls

nme.system.System.exit(1);

This kicks the user out to the home/menu screen. But once you return to the app, the ads have disappeared. It seems the whole system has been killed - as forcing them to reappear (by firing off another "show Ad" block) doesn't seem to work. Can anything be done with this? Am I doing the right thing by calling this code to force a quit?

Thanks in advance
Guy

mat0pad

  • Posts: 364
I have two suggestions for this extension:
  • Add a block to check if a full screen ad  fails to load
     
  • Add a block to check if a banner fails to load.
This would give more options for supplementing fx. for chartboost and vungle.
Furtermore you could just place a banner with one of your other apps to get some cross-promotion if a banner/full screen ad fails to load.
   


                              

Konig Studios

  • Posts: 76
EDIT: So i found out that the problem is coming from using the Facebook Extension (http://community.stencyl.com/index.php/topic,26710.0.html). Any chance of a fix for this?

So My game is crashing with the Admob extension (newest version). It's weird because it builds fine with the example project, but my game crashes when I use the admob block.

I am getting
Code: [Select]
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADSlot state]: unrecognized selector sent to instance 0xcfefa40'
I looked it up and this is what needed to be done (http://stackoverflow.com/questions/20079059/how-to-fix-unrecognized-selector-issue-in-admob-implementation)
Code: [Select]
Go to Project settings > Build Settings And set -ObjC in Other Linker Flags.
Is this something that needs to be fixed in the Admob extension?

« Last Edit: February 09, 2014, 01:40:49 pm by Konig Studios »

Abliblablobla

  • *
  • Posts: 524
@GuyCockrcroft
I am sorry for the late reply. I will look into it the next days.

@mat0pad
Thank you for your suggestions! I'll try to implement them as soon as possible.

@Konig Studios
I will look into it in the next few days. I assume you are getting this error on an iOS device. Are you experiencing the same issue on an Android device? Could you post a screenshot of your behavior(s)? Thank you.
.: BuruBuru :.

Konig Studios

  • Posts: 76
@GuyCockrcroft
I am sorry for the late reply. I will look into it the next days.

@mat0pad
Thank you for your suggestions! I'll try to implement them as soon as possible.

@Konig Studios
I will look into it in the next few days. I assume you are getting this error on an iOS device. Are you experiencing the same issue on an Android device? Could you post a screenshot of your behavior(s)? Thank you.

I found out that the problem is coming from using the Facebook Extension (http://community.stencyl.com/index.php/topic,26710.0.html). Any chance of a fix for this?

Abliblablobla

  • *
  • Posts: 524
So the problem surfaces when you use the AdMob and the Facebook extensions at the same time?
.: BuruBuru :.