admob for beginners

Hello everyone.
I’m a beginner developer and I want to deal with Admob.
I try to do as it is written here


but test ads are not shown. I’m testing on an android device
What am I doing wrong? Help me
my code is below

build.settings

 settings =
 {
    orientation =
    {
	    -- Supported values for orientation:
	    -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight
	    default = "portrait",
	    supported = { "portrait", },
    },

    --
    -- Android section
    --
     android =
    {   
    

        applicationChildElements =
        {
           [[
                <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
                    android:value="ca-app-pub-3940256099942544~3347511713"/>  -- replace 
                   with your app id. See: https://goo.gl/fQ2neu
            ]],
        },
    },



    --
    -- Plugins section
    --
    plugins = {
        ["plugin.admob"] =
        {
            publisherId = "com.coronalabs"
        },
       -- See: http://docs.coronalabs.com/plugin/att
    },


    --
    -- Project section
    --
    excludeFiles =
    {
	    -- Exclude unnecessary files for each platform
	    all = { "Icon.png", "Icon-*dpi.png", "Images.xcassets", },
	    android = { "LaunchScreen.storyboardc", },
    },

}

and main

txtDebug = native.newTextField( display.contentWidth * 0.5, 100, display.contentWidth, 35 )
txtDebug.align = "center"
txtDebug:setTextColor( 1, 0.5, 0 )
txtDebug.text = "Ad Debug"

uidBanner = "ca-app-pub-3940256099942544/6300978111"
uidInters = "ca-app-pub-3940256099942544/1033173712" 
adsBanner = require( "plugin.admob" ) 
adsInterstitial = require( "plugin.admob" ) 
isBannerShow = false



local widget = require "widget"


local function handleButtonBannerEvent( event )
    if ( "ended" == event.phase ) then
        if ( isBannerShow == false ) then
            print( "Banner was pressed and released" )
            txtDebug.text = "show banner"
            adsBanner.show( "banner", { x=0, y=0} )
            isBannerShow = true;
        else
            txtDebug.text = "hide banner"
            adsBanner.hide()
            isBannerShow = false
         end 
    end
  end

local btnBanner = widget.newButton{
label="Test Banner",
labelColor = { default={255}, over={128} },
default="button.png",
over="button-over.png",
width=154, height=40,
onRelease = handleButtonBannerEvent -- event listener function
 }
btnBanner.x = display.contentWidth * 0.5
btnBanner.y = display.contentHeight - 300



local function handleButtonIntersEvent( event )

    if ( "ended" == event.phase ) then
        if ( adsInterstitial.isLoaded( "interstitial" ) ) then 
           txtDebug.text = "show Interstitial"
           print( "Interstitial was pressed and released" )
           adsInterstitial.show( "interstitial", { x=0, y=0} )
        else
            txtDebug.text = "Inters Not Ready Try Load"
            adsInterstitial.load( "interstitial", {adUnitId=uidInters} )
        end
     end
 end

local btnInters = widget.newButton{
   label="Test Interstitial",
  labelColor = { default={255}, over={128} },
  default="button.png",
  over="button-over.png",
  width=154, height=40,
  onRelease = handleButtonIntersEvent -- event listener function
 }
btnInters.x = display.contentWidth * 0.5
btnInters.y = display.contentHeight - 250



local function handleReloadIntersEvent( event )

    if ( "ended" == event.phase ) then
        txtDebug.text = "Re-Load Interstitial"
        adsInterstitial.load( "interstitial", {adUnitId=uidInters} )
    end
end

local btnLoadInters = widget.newButton{
  label="Reload Interstitial",
  labelColor = { default={255}, over={128} },
  default="button.png",
  over="button-over.png",
  width=154, height=40,
  onRelease = handleReloadIntersEvent -- event listener function
 }
btnLoadInters.x = display.contentWidth * 0.5
btnLoadInters.y = display.contentHeight - 200



local function adBannerListener( event )
    if ( event.isError ) then
        -- Failed to receive an ad
        print( "Error init Banner " + event.isError )
        txtDebug.text = "Error init Banner " + event.isError
    end
end

local function adInterstitialListener( event )
    if ( event.isError ) then
        -- Failed to receive an ad
        print( "Error init Interstitial " + event.isError )
        txtDebug.text = "Error init Interstitial " + event.isError   
    end
end


-- Call initialize of Admob
adsBanner.init(adBannerListener, {appId="ca-app-pub-3940256099942544~3347511713", 
testMode = true})
adsInterstitial.init( adInterstitialListener, {appId="ca-app-pub- 
3940256099942544~3347511713", testMode = true})

 adsInterstitial.load( "interstitial", {adUnitId=uidInters} )

I think the best thing to do is to connect the device to your computer and run adb logcat to dump the logs to the screen (or a file) to see what the specific error is. It’s somewhat difficult to guess based on your comments and code.

I agree with @schizoid2k- adb logcat is definitely going to be your friend here. Also, you say the ads aren’t shown. Are they being successfully loaded? (I notice you’ve got some debug text about that.)

Two other things right off the bat:

  • In spite of what the docs say, you no longer include your appId in the init params. (You’ll see a warning about that from AdMob in the logcat output.)
  • Requiring the AdMob plugin twice and assigning it two different names seems overly complicated. Because you are having a problem, it might be easier to debug if your code followed the example code in the docs a little more closely.

I think the main issue is what @colinmorgan stated.

  • Requiring the AdMob plugin twice and assigning it two different names seems overly complicated. Because you are having a problem, it might be easier to debug if your code followed the example code in the docs a little more closely.