Admob不会显示在我的应用上

时间:2014-10-22 08:54:05

标签: android admob

我已经插入了代码AdMob广告,但它没有显示在我的手机上(我没有在衬衫上运行)。我还没有在商店发布应用程序。

在AndroidManifest文件中

布局文件中的代码:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/gameover"
    android:orientation="vertical"
    android:paddingLeft="7dp"
    android:paddingRight="7dp"
    android:background="@color/bgend" >

    <Button
        android:id="@+id/btnBackhome"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/yourBest"
        android:layout_marginBottom="80dp"
        android:layout_marginRight="48dp"
        android:background="@drawable/rate" />

    <Button
        android:id="@+id/btnReplay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/btnBackhome"
        android:layout_alignLeft="@+id/yourBest"
        android:layout_marginLeft="34dp"
        android:background="@drawable/play" />

    <TextView
        android:id="@+id/yourBest"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/yourMove"
        android:layout_alignTop="@+id/yourMove"
        android:layout_marginTop="39dp"
        android:gravity="center"
        android:text="Best: "
        android:textColor="@android:color/white"
        android:textSize="18dp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/yourMove"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/Replay"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="74dp"
        android:gravity="center"
        android:text="New: "
        android:textColor="@android:color/white"
        android:textSize="18sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/Best"
        android:layout_alignLeft="@+id/Move"
        android:layout_marginBottom="14dp"
        android:gravity="center"
        android:text="Game Over"
        android:textColor="@android:color/white"
        android:textSize="30sp"

        android:textStyle="bold" />


        <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        ads:adSize="BANNER" 
        ads:adUnitId="ca-app-pub-........"
        />


</RelativeLayout>

代码gameover.java。我删除了命令行来测试虚拟机

&#13;
&#13;
package com.vudinh.eastmath;

  

import android.support.v7.app.ActionBarActivity;
import android.app.Activity;

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;


public class GameOverActivity extends Activity {

	
    
	@Override
	protected void onCreate(Bundle savedInstanceState) {

		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		setContentView(R.layout.game_over);
		// TODO Auto-generated constructor stub

		AdView adView = (AdView) this.findViewById(R.id.adView);
        //request TEST ads to avoid being disabled for clicking your own ads
        AdRequest adRequest = new AdRequest.Builder()
                //.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)// This is for emulators
                
               // .addTestDevice("2EAB96D84FE62876379A9C030AA6A0AC") 
                .build();
        adView.loadAd(adRequest);
    
		
	}
   	
		
}
&#13;
&#13;
&#13;

Proguard文件:

&#13;
&#13;
-dontwarn **CompatHoneycomb
-keep class android.support.v4.** { *; }
-dontwarn android.support.v4.**
-dontskipnonpubliclibraryclassmembers
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep class com.startapp.** {
*;
}

-keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile,
LineNumberTable, *Annotation*, EnclosingMethod
-dontwarn android.webkit.JavascriptInterface
-dontwarn com.startapp.**

-keep class javax.** { *; }
-keep class org.** { *; }
-keep class twitter4j.** { *; }

-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembers class * {
native <methods>;
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
} 
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

您的代码似乎没有任何问题。 看看您的日志,您应该看到广告请求和响应。 如果没有要展示的广告,您会在日志中看到,但屏幕上不会显示任何内容。