AdMob smart banner size is not updated on screen orientation change

AdMob smart banner size is not updated on screen orientation change
0.0 0


I’m using AdMob plugin within my cocos2d-x game.

It seems that plug-in doesn’t support screen orientation change.
When app started in portrait mode getCurrBannerHeight() returns 50dp and everything ok.
After changing screen orientation into landscape getCurrBannerHeight ( ) returns correct size (32dp) but banner still shown having 50dp of height.

Is there are any workarounds exist?


a workaround: default your heights,

landscape: 32, others 50.


Hi all,
I cant creat threat. Please help me when build to apk file. Its error the same picture.



how to duplicate it ? what env ?

cocos2d-x version ?
Android Studio or Eclipse ?
using cocos compile ?


Im use:

  • cocos2d-x ver 3.15.1
  • NDK r13b
  • ANT: 1.10.1
    Im using cocos compile project.

cocos compile -p android


cocos compile -p android --android-studio


But what if my screen is 1080 or even 1920 pixels height? Then 50 pixels is too small! :frowning:


how about using different banner for two orientation?


You mean… What do you mean? :slight_smile:
I want banner to look nice on any screen size (resolution) - so I don’t want to use preset banner size.

I use smart banner - with both sizes 0. I don’t want to set banner size or width or height. Because screen width may vary from 240 to 1920 - banner with preset width or height (like 50 px) may look ugly or be not visible.

Alas, if I rotate the screen twice, then banner stops to update:

  1. I start (app or to show AdBanner) with Landscape orientation - so appears very wide banner;
  2. I turn the device to Portrait orientation - banner disappears and do not appear any more.
  3. If I turn the device back to Landscape orientation - appears old banner but it does not update.
    How it could be fixed?