Admob not generating visuals

放肆的年华 提交于 2019-12-24 07:16:07

问题


My admob banner is not showing up on my screen. it compiles and runs fine. i tried to insert it in several places. I am using it as a footer for the application. I left the second on commented out so that you could see where the idea was that I was trying to put it.

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
             >
<ScrollView 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:foregroundGravity="right"
    android:background = "@drawable/background"
     >


<TableLayout
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
 >    

    <TableRow>        
    <Button 
      android:id="@+id/btn1"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="hot enough"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn2"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="learned"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn3"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="hilbilly"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn4"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="rot"
      android:textColor="#ff0000"
    />    
    </TableRow>
    <TableRow>   
       <Button 
      android:id="@+id/btn73"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
       android:background="#00000000"      
       android:text="nicetry"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn74"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="look bad"
      android:textColor="#ff0000"
    />
     <Button 
      android:id="@+id/btn75"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="revenge"
      android:textColor="#ff0000"

    />                 
    <Button 
      android:id="@+id/btn76"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="group"
      android:textColor="#ff0000"
    /> 
    </TableRow>
    <TableRow>   
       <Button 
      android:id="@+id/btn77"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="takedown"
      android:textColor="#ff0000"
    />    
        <Button 
      android:id="@+id/btn78"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
       android:background="#00000000"      
       android:text="knock"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn79"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="casket"
      android:textColor="#ff0000"
    />       
    </TableRow>
<!--    <TableRow>
  <com.google.ads.AdView 
     android:id="@+id/adView"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     ads:adUnitId="pub-4235852256372242"
     ads:adSize="BANNER"
     ads:testDevices="TEST_EMULATOR, 512CF178FE3E3613A01DC3FBA545BD86"
     ads:loadAdOnCreate="true"
     />        
    </TableRow> 
    -->
</TableLayout>      

</ScrollView>
          <com.google.ads.AdView 
     android:id="@+id/adView"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     ads:adUnitId="pub-4235852256372242"
     ads:adSize="BANNER"
     ads:testDevices="TEST_EMULATOR, 512CF17****************"
     ads:loadAdOnCreate="true"
     /> 
</LinearLayout>

10-01 23:19:53.294: D/ActivityThread(12826): setTargetHeapUtilization:0.25
10-01 23:19:53.294: D/ActivityThread(12826): setTargetHeapIdealFree:8388608
10-01 23:19:53.294: D/ActivityThread(12826): setTargetHeapConcurrentStart:2097152
10-01 23:19:53.474: D/dalvikvm(12826): GC_FOR_ALLOC freed 57K, 30% free 14739K/20995K,     paused 25ms, total 26ms
10-01 23:19:53.544: D/dalvikvm(12826): GC_CONCURRENT freed <1K, 21% free 24914K/31175K, paused 20ms+6ms, total 44ms
10-01 23:19:53.964: I/webclipboard(12826): clipservice:  android.sec.clipboard.ClipboardExManager@435a37d0
10-01 23:19:54.004: I/webclipboard(12826): clipservice: android.sec.clipboard.ClipboardExManager@435a37d0
10-01 23:19:54.195: I/webclipboard(12826): clipservice: android.sec.clipboard.ClipboardExManager@435a37d0
10-01 23:19:54.205: V/webkit(12826): BrowserFrame constructor: this=Handler   (android.webkit.BrowserFrame) {4359e848}
10-01 23:19:54.325: V/webkit(12826): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {436661b8}
10-01 23:19:54.325: V/webkit(12826): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {4366da58}
10-01 23:19:54.465: I/Adreno200-EGLSUB(12826): <ConfigWindowMatch:2087>: Format RGBA_8888.
10-01 23:19:54.525: E/(12826): <s3dReadConfigFile:75>: Can't open file for reading
10-01 23:19:54.525: E/(12826): <s3dReadConfigFile:75>: Can't open file for reading
10-01 23:19:54.725: I/Ads(12826): adRequestUrlHtml: <html><head><script   src="http://media.admob.com/sdk-core-v40.js"></script> <script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":0,"session_id":"2377731330464712201 ","seq_num":"1","slotname":"pub- 4235852256372242","u_w":360,"msid":"com.mrj05hua.hanselgretelwhfree","adtest":"on","js":"af ma-sdk-a- v6.4.1","bas_off":0,"net":"wi","app_name":"1.android.com.mrj05hua.hanselgretelwhfree","hl": "en","gnt":13,"carrier":"311480","u_audio":3,"kw":[],"u_sd":2,"ms":"xxPCYSmHc43AN0YQtB8lGKj2Nu9vDYWw8gtoq7Hi8wmKf5LNzvuTUqGgNUoYXdWcrBgSfDwLuSWaxYKq3qmQra0A5dPF1rppxBS9U0n05OLIqyXKefZQ-ihaTYaGjnUalp6LbNQUQpeHG6H6w_LhCpzxs_th1Om5ot-JZEA-gN25L-iXBS7DEU4_W-s4eMW3SzqYcvY3FsMLQJtA805-ixUsWHeaesRbxyStEOPWOYi0sujnAJ3zb6LnfwQHC-ZQsx56r4yj-o8bTFg275wd260E6P8aBZ70GskV0IDEijwQWiS9WpK7nx-3l38Ift5ANXbvxPvEZSHNxizH8xAacg","mv":"80230011.com.android.vending","isu":"512CF178FE3E3613A01DC3FBA545BD86","format":"320x50_mb","oar":0,"ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"u_h":640,"pt":2,"bas_on":0,"ptime":0});</script></head><body></body></html>
10-01 23:19:55.666: D/WebCore(12826): uiOverrideUrlLoading: shouldOverrideUrlLoading() returnstrue
10-01 23:19:55.706: I/GATE(12826): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
10-01 23:19:55.776: W/Ads(12826): Invalid unknown request error: Cannot determine  request type. Is your ad unit id correct?
10-01 23:19:55.776: D/WebCore(12826): uiOverrideUrlLoading: shouldOverrideUrlLoading() returnstrue
10-01 23:19:55.776: I/Ads(12826): onFailedToReceiveAd(Invalid Ad request.)

回答1:


Your adUnitId is incorrect. It should be something like " ca-app-pub-XXXXXXXXXXXX/YYYYYYYYYY", not "pub-4235852256372242"




回答2:


You can refer

Admob ad not showing up in emulator or phone

If you are new user in admob it might take couple of days to load actual ads.



来源:https://stackoverflow.com/questions/19082336/admob-not-generating-visuals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!