2015-02-04

Admob integration in Cocos2d-x v3.4 with plugin-x (Android - part 3/3)

<- to Part 2/3

1. Prerequisites

Download API 7,8,10,17,19 & Google Play services from Android SDK Manger




Expand Eclipse Memory heap

Fix eclipse.ini at the folder where you installed Eclipse.





2. Build Plugin-x Library

Excute Terminal, move to the folder below and run publish.sh

MyGame/cocos2d/plugin/tools/publish.sh

After running publish.sh, enter the paths of ndk, sdk, ant.



After completing the build, check for Protocol,admob plugin lib has been created.





3. Change Android build setting

After completing the build at the Terminal, run Game developer guide tool(gameDevGuide.sh)

MyGame/cocos2d/plugin/tools/gameDevGuide.sh




If you can't run because of GNU AWK, download and install gawk-3.1.8-1.dmg.  (gawk-3.1.8-1.dmg download)




After excuting Game developer guide tool, enter the path of the project's Android folder. (MyGame/proj.android in this tutorial)




Select the Plugin you want to use.(In this tutorial, we'll choose AdMob)




Copy and replace the contents in the admob_cocos2dx_3_4-master/proj.android folder.



4. Eclipse Setting 

Set CDT ndk build environment path like below.



Import Cocos2d-X and Google Play services's Library Projects.

cocos2d-xcocos2d-x-3.4/cocos/platform/android/java
Google Play servicesandroid-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib




For convenience, turn off the “Build Automatically” setting in Eclipse.




Import MyGame project.



Set the "Android" and "Java Build Path" settings of MyGame Project.






5. Result




댓글 7개:

  1. Admob 강좌 1/2/3편 잘 봤습니다, 고생 많이 하셨겠어요.
    저도 cocos2d-x 3.4로 개고생해서 plugin-x 로 admob, facebook 연결 하고 iap 작업중인데 강좌 중간에 개고생에 공감하고 댓글 남겨요.
    머 하나 삐끗하면 안돌아 가기 일쑤인데 그런면에서 디테일한 설명과 팁 좋습니다.
    앞으로도 좋은 강좌 기대하겠습니다.

    답글삭제
    답글
    1. 도움이 되셨다니 기쁩니다.
      감사합니다

      삭제
  2. You are currently using version 6.9.2 of the SDK, which doesn't officially support iOS 8. Please consider updating your SDK to the most recent sdk version, 7.1.0, to get iOS 8 support, including a fix for smart banner rendering in landscape mode. The latest SDK can be downloaded from http://goo.gl/iGzfsP. A full list of release notes is available at https://developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes.

    Can you update newest sdk for ios? thank!

    답글삭제
  3. and i see that you should uncomment at line 216: adView.setAdListener(new AdmobAdsListener());

    답글삭제
  4. from where to Copy and replace the contents in the admob_cocos2dx_3_4-master / proj.android folder.

    답글삭제