请告诉我为什么会显示游戏画面,但我看不到横幅广告。我现在已经找了一周与AdMob相关的所有内容,但仍然没有解决问题。我需要帮助。感谢。
我的“AndroidLauncher.java”
public class AndroidLauncher extends AndroidApplication {
protected AdView adView;
protected View gameView;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
RelativeLayout layout = new RelativeLayout(this);
RelativeLayout.LayoutParams gameViewParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
View gameView = initializeForView(new TestAds(), config);
AdView adView = new AdView(this);
adView.setAdUnitId("my-ca-app-pub");
adView.setBackgroundColor(Color.TRANSPARENT);
adView.setAdSize(AdSize.BANNER);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("MY DEVICE ID").build();
adView.loadAd(adRequest);
layout.addView(gameView, gameViewParams);
RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,
RelativeLayout.TRUE);
layout.addView(adView, adParams);
setContentView(layout);
}
}
我的“AndroidManifest.xml”
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mygdx.testads.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<!-- Include required permissions for Google Mobile Ads to run -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/GdxTheme" >
<!-- This meta-data tag is required to use Google Play Services. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.mygdx.testads.android.AndroidLauncher"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Include the AdActivity configChanges and theme. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>
我的“LogCat”
01-02 06:13:25.687: D/dalvikvm(1176): Trying to load lib /data/app-lib/com.mygdx.testads.android-2/libgdx.so 0xb1e07c50
01-02 06:13:25.707: D/dalvikvm(1176): Added shared lib /data/app-lib/com.mygdx.testads.android-2/libgdx.so 0xb1e07c50
01-02 06:13:25.707: D/dalvikvm(1176): No JNI_OnLoad found in /data/app-lib/com.mygdx.testads.android-2/libgdx.so 0xb1e07c50, skipping init
01-02 06:13:25.787: D/(1176): HostConnection::get() New Host Connection established 0xb7e81598, tid 1176
01-02 06:13:26.467: W/dalvikvm(1176): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-02 06:13:26.467: W/dalvikvm(1176): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-02 06:13:26.477: W/dalvikvm(1176): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-02 06:13:26.487: W/dalvikvm(1176): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-02 06:13:26.517: W/dalvikvm(1176): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-02 06:13:26.517: W/dalvikvm(1176): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-02 06:13:26.527: W/dalvikvm(1176): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-02 06:13:26.527: E/dalvikvm(1176): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
01-02 06:13:26.527: W/dalvikvm(1176): VFY: unable to resolve instanceof 167 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
01-02 06:13:26.527: D/dalvikvm(1176): VFY: replacing opcode 0x20 at 0x0008
01-02 06:13:26.527: E/dalvikvm(1176): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
01-02 06:13:26.527: W/dalvikvm(1176): VFY: unable to resolve check-cast 167 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
01-02 06:13:26.527: D/dalvikvm(1176): VFY: replacing opcode 0x1f at 0x000c
01-02 06:13:27.107: W/GooglePlayServicesUtil(1176): Google Play services is missing.
01-02 06:13:27.277: W/GooglePlayServicesUtil(1176): Google Play services is missing.
01-02 06:13:27.317: V/WebViewChromium(1176): Binding Chromium to the main looper Looper (main, tid 1) {b1e035c0}
01-02 06:13:27.337: I/chromium(1176): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
01-02 06:13:27.357: I/BrowserProcessMain(1176): Initializing chromium process, renderers=0
01-02 06:13:27.577: W/chromium(1176): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
01-02 06:13:27.787: I/Ads(1176): Starting ad request.
01-02 06:13:27.897: I/AndroidInput(1176): sensor listener setup
01-02 06:13:27.987: D/dalvikvm(1176): GC_FOR_ALLOC freed 326K, 16% free 3346K/3956K, paused 77ms, total 78ms
01-02 06:13:28.197: W/EGL_emulation(1176): eglSurfaceAttrib not implemented
01-02 06:13:28.207: D/OpenGLRenderer(1176): Enabling debug mode 0
01-02 06:13:28.277: D/(1176): HostConnection::get() New Host Connection established 0xb7eb6708, tid 1189
01-02 06:13:28.337: W/GL2JNIView(1176): creating OpenGL ES 2.0 context
01-02 06:13:28.757: D/dalvikvm(1176): Trying to load lib /data/app-lib/com.mygdx.testads.android-2/libgdx.so 0xb1e07c50
01-02 06:13:28.757: D/dalvikvm(1176): Shared lib '/data/app-lib/com.mygdx.testads.android-2/libgdx.so' already loaded in same CL 0xb1e07c50
01-02 06:13:28.817: I/GL2(1176): all initialized 2
01-02 06:13:28.817: I/AndroidGraphics(1176): OGL renderer: Android Emulator OpenGL ES Translator (Intel(R) HD Graphics 5000)
01-02 06:13:28.817: I/AndroidGraphics(1176): OGL vendor: Google (Intel)
01-02 06:13:28.887: I/AndroidGraphics(1176): OGL version: OpenGL ES 2.0 (4.2.0 - Build 10.18.10.3345)
01-02 06:13:28.887: I/AndroidGraphics(1176): OGL extensions: GL_EXT_debug_marker GL_OES_EGL_image GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float
01-02 06:13:28.887: E/EGL_emulation(1176): [getAttribValue] Bad attribute idx
01-02 06:13:28.887: E/EGL_emulation(1176): tid 1189: eglGetConfigAttrib(605): error 0x3004 (EGL_BAD_ATTRIBUTE)
01-02 06:13:28.887: E/EGL_emulation(1176): [getAttribValue] Bad attribute idx
01-02 06:13:28.897: E/EGL_emulation(1176): tid 1189: eglGetConfigAttrib(605): error 0x3004 (EGL_BAD_ATTRIBUTE)
01-02 06:13:28.897: I/AndroidGraphics(1176): framebuffer: (5, 6, 5, 0)
01-02 06:13:28.897: I/AndroidGraphics(1176): depthbuffer: (16)
01-02 06:13:28.897: I/AndroidGraphics(1176): stencilbuffer: (0)
01-02 06:13:28.897: I/AndroidGraphics(1176): samples: (0)
01-02 06:13:28.897: I/AndroidGraphics(1176): coverage sampling: (false)
01-02 06:13:28.997: I/AndroidGraphics(1176): Managed meshes/app: { }
01-02 06:13:28.997: I/AndroidGraphics(1176): Managed textures/app: { }
01-02 06:13:29.057: I/AndroidGraphics(1176): Managed shaders/app: { }
01-02 06:13:29.057: I/AndroidGraphics(1176): Managed buffers/app: { }
01-02 06:13:30.137: D/dalvikvm(1176): GC_FOR_ALLOC freed 45K, 14% free 3476K/4036K, paused 557ms, total 557ms
01-02 06:13:32.457: D/dalvikvm(1176): DexOpt: --- BEGIN 'ads1153770144.jar' (bootstrap=0) ---
01-02 06:13:42.347: D/dalvikvm(1176): DexOpt: --- END 'ads1153770144.jar' (success) ---
01-02 06:13:42.347: D/dalvikvm(1176): DEX prep '/data/data/com.mygdx.testads.android/cache/ads1153770144.jar': unzip in 2ms, rewrite 9882ms
01-02 06:14:12.437: D/dalvikvm(1176): GC_FOR_ALLOC freed 401K, 17% free 3542K/4252K, paused 88ms, total 96ms
01-02 06:14:12.447: I/dalvikvm-heap(1176): Grow heap (frag case) to 3.949MB for 225520-byte allocation
01-02 06:14:12.567: D/dalvikvm(1176): GC_FOR_ALLOC freed 1K, 16% free 3761K/4476K, paused 98ms, total 99ms
01-02 06:14:13.277: D/dalvikvm(1176): GC_FOR_ALLOC freed 1K, 16% free 3760K/4476K, paused 67ms, total 68ms
01-02 06:14:13.427: I/dalvikvm-heap(1176): Grow heap (frag case) to 6.367MB for 2536936-byte allocation
01-02 06:14:13.577: D/dalvikvm(1176): GC_FOR_ALLOC freed <1K, 11% free 6238K/6956K, paused 149ms, total 149ms
01-02 06:14:19.117: I/chromium(1176): [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.appcache", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
01-02 06:14:19.247: I/chromium(1176): [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
01-02 06:14:22.697: W/Ads(1176): There was a problem getting an ad response. ErrorCode: 0
01-02 06:14:22.877: W/Ads(1176): Failed to load ad: 0
01-02 06:14:27.127: W/chromium(1176): [WARNING:aw_content_browser_client.cc(126)] Failed to find the associated render view host for url: gmsg://mobileads.google.com/jsLoaded?google.afma.Notify_dt=1420197266599