Friday, November 15, 2013

How to add Admob ANE into the Flash Builder project?

If you are first time integrating Adobe Native Extension (ANE) into the Flash Builder project (here, i demo an Andoid project), I bet you would have encountered some issues during debugging.

In this post, particularly, I would like to talk about adding Admob into the Flash Builder project. Since the Admob doesn't officially provide the ANE, here I am using the third-party one in the demo.

 If you have come across the error message such as:

VerifyError: Error #1014: Class so.cuo.anes.admob::Admob could not be found.

OR the error pop up similar to:

Error: Requested extension so.cuo.ane.Admob could not be found.



 then this is the right place to look for.


To revise, there are 2 steps to properly add an Adobe ANE into the Flash Builder (here, it is Admob ANE):

Step 1:

Go to Project Tab -> Properties -> Actionscript Build Path -> Native Extensions -> Add ANE


Step 2: (Which is most of the time overlooked by the beginner)

Go to Project Tab -> Properties -> Actionscript Build Packaging -> Google Android -> Tick the Checkbox of the Package


If you miss the step 2, you will face the errors mentioned.

One more thing, unlike using the Admob jar library in the Java project, the one provided by the third-party doesn't support Admob Ads in the debugging mode. You could only 'see' the Ads coming out if you "Export Release Build".

***Updated***
Following the link provided by Mike Monti, I am also able to display the Admob Ads.
One thing to remind is that, remember to add the following in your xml tags:
<meta-data android:name="com.google.android.gms.version" android:value="4323000"/>
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
To produce the Banner ads, you can simply follow the code below:

var adMobManager:AdMobManager = AdMobManager.manager;
if(adMobManager.isSupported)
     {
          adMobManager.bannersAdMobId = "ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx";
          adMobManager.createBanner(AdMobSize.SMART_BANNER,    AdMobPosition.BOTTOM_CENTER,"BottomBanner",null,true);
          adMobManager.showAllBanner();
      }

Hope this helps.

14 comments:

  1. I did try several times to make work "so.cuo.anes.admob" and i never managed to make it work properly.

    That ANE s also full of bugs and with old AdMob SDK which will not pass Google and App Store approval.

    I did find instead this ANE:
    - https://github.com/Code-Alchemy/AdMobAne

    Which has all AdMob functions, allow multiple banners, use the latest SDK, full documentation in English and work flawless right away!

    For any one who needs a reliable AdMob ANE i strongly suggest it!

    ReplyDelete
    Replies
    1. Thanks Mike Monti for bringing up this.

      "On August 1, 2014, the Play Store will stop accepting new or updated apps that use the standalone Google AdMob SDK"... So it is using the Google Play Services API instead (for Android).

      Will try out whether it works for me. Hope that it is updated in line with the latest Adobe AIR version as well~

      Delete
    2. By the way, so far the existing Adobe ANE that i used still works properly. Not sure if your Adobe AIR version updated or not.

      Delete
    3. Hi Edward,
      Yes also adobe air compiler is updated.
      As far as i know this release is build with AIR 4.0, and the next update seems it will be build with AIR 13.
      However the Application XML will always have the tag 3.1 and according to the developer this is exclusively for compatibility.
      As far as i saw until know it is always kept updated.

      Delete
    4. Hm... it is strange to know that it isn't working at your side.

      I will try the Admob ANE that you posted and update this post. (maybe in around 1 week)

      Delete
    5. Hi Mike Monti, I have tried your link. And yes it works. Thanks~

      Delete
  2. I am really struggling through this.
    How can I insert the codes in my application mxml?
    I've already done these two steps and it still won't export properly.

    ReplyDelete
  3. Hi Gregorio, what type of project are you creating?
    In my case, it is an "Actionscript Mobile Project" in the Flash Builder. After adding the Admob ANE, and tick the checkbox of the package, my application xml will automatically have the required information automatically added.

    Would you please printscreen the error message that you come across? (or post the error message here)

    ReplyDelete
  4. Hi Guys,
    I just realize i am using the Admob ANE version 6.6.0 (which is, not yet integrated into the Google Play Service YET - Old Admob). I will come back to this after upgrading the Admob and replacing with the version 6.8.0.

    ReplyDelete
  5. I have updated this post. Recently i have upgraded the Admob + using the adobe ane provided by Mike Monti. Hope everyone has no more issue when integrating the latest admob into the flash builder.

    ReplyDelete
  6. Hi can anyone provide me with a sample FLA i did everything as it should but the banner doesn't appear please help
    here is my email
    jawadbahar90@gmail.com
    Thanks in advance

    ReplyDelete
    Replies
    1. Hi, the latest admob version from the alchemy comes with samples as well. You may have a look.

      Delete
  7. Hi, I am trying to find the ANE at this link - https://github.com/Code-Alchemy/AdMobAne. However the repository is disabled. Therefor I was wondering if someone could send me the ANE? Thank you in advance!

    ReplyDelete
    Replies
    1. Hi Ivan Nikolov, I am curious why the ANE is disabled as well. It was working months ago.

      I hope it wasn't due to some unfavorable reasons..

      Anyway, my advice is, to purchase one from the milkmangames. Free ANE is good, but paid one comes with faster service (eg: update). Not sure if the Alchemy admob is still up-to-date or not.

      Delete