2016-04-17 84 views
0

我想在Android應用中顯示一個簡單的測試廣告。我用這個GitHub的項目來測試AdMob在應用中不顯示

https://github.com/googleads/googleads-mobile-android-examples/tree/master/admob/BannerExample

我也通過這個例子https://developers.google.com/admob/android/quick-start#configure_gradle

進出口使用的IntelliJ,而不是Android的工作室,這樣還沒有能夠嚴格地遵守它不見了。

我的問題是,廣告似乎不出現。日誌在下面,我在旁邊添加了一些**,我認爲這可能會有問題。我也添加了我的代碼。我還沒有添加任何東西的清單文件(我還沒有看到,我有任一實例)

我使用模擬器。我可以使用什麼模擬器有某些限制嗎?目前,我從來沒有看到任何廣告或廣告應該在哪個佔位符。

任何幫助非常感謝。 感謝

CODE

佈局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
      xmlns:ads="http://schemas.android.com/apk/res-auto" 
      android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 
      android:paddingRight="@dimen/activity_horizontal_margin" 
      android:paddingTop="@dimen/activity_vertical_margin" 
      android:paddingBottom="@dimen/activity_vertical_margin" 
      tools:context=".EntryPoint"> 

    <TextView android:text="@string/hello_world" android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 

    <com.google.android.gms.ads.AdView 
     android:id="@+id/ad_view" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_alignParentBottom="true" 
     ads:adSize="BANNER" 
     ads:adUnitId="@string/banner_ad_unit_id"> 
    </com.google.android.gms.ads.AdView> 

</RelativeLayout> 

代碼

private AdView mAdView; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_my); 
    mAdView = (AdView) findViewById(R.id.ad_view); 
    AdRequest adRequest = new AdRequest.Builder() 
      .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) 
      .build(); 
    mAdView.loadAd(adRequest); 
} 

/** Called when leaving the activity */ 
@Override 
public void onPause() { 
    if (mAdView != null) { 
     mAdView.pause(); 
    } 
    super.onPause(); 
} 

/** Called when returning to the activity */ 
@Override 
public void onResume() { 
    super.onResume(); 
    if (mAdView != null) { 
     mAdView.resume(); 
    } 
} 

/** Called before the activity is destroyed */ 
@Override 
public void onDestroy() { 
    if (mAdView != null) { 
     mAdView.destroy(); 
    } 
    super.onDestroy(); 
} 

日誌

5222-5222/? I/art﹕ Not late-enabling -Xcheck:jni (already on) 
5222-5222/? I/art﹕ Late-enabling JIT 
5222-5222/? I/art﹕ JIT created with code_cache_capacity=2MB compile_threshold=1000 
** 5222-5222/my.app W/System﹕ ClassLoader referenced unknown path: /data/app/my.app-2/lib/arm 
** 5222-5222/my.app W/GooglePlayServicesUtil﹕ Google Play services is missing. 
5222-5222/my.app I/WebViewFactory﹕ Loading com.android.webview version 44.0.2403.119 (code 246011900) 
5222-5222/my.app W/System﹕ ClassLoader referenced unknown path: /system/app/webview/lib/arm 
5222-5222/my.app I/LibraryLoader﹕ Time to load native libraries: 44 ms (timestamps 1048-1092) 
5222-5222/my.app I/LibraryLoader﹕ Expected native library version number "",actual native library version number "" 
5222-5250/my.app W/art﹕ Long monitor contention event with owner method=void java.lang.Thread.nativeCreate(java.lang.Thread, long, boolean) from Thread.java:4294967294 waiters=0 for 206ms 
5222-5231/my.app W/art﹕ Suspending all threads took: 91.755ms 
5222-5222/my.app V/WebViewChromiumFactoryProvider﹕ Binding Chromium to main looper Looper (main, tid 1) {84fa4d0} 
5222-5222/my.app I/LibraryLoader﹕ Expected native library version number "",actual native library version number "" 
5222-5222/my.app I/chromium﹕ [INFO:library_loader_hooks.cc(120)] Chromium logging enabled: level = 0, default verbosity = 0 
5222-5222/my.app I/BrowserStartupController﹕ Initializing chromium process, singleProcess=true 
5222-5222/my.app W/art﹕ Attempt to remove non-JNI local reference, dumping thread 
5222-5222/my.app E/SysUtils﹕ ApplicationContext is null in ApplicationStatus 
5222-5222/my.app W/chromium﹕ [WARNING:resource_bundle.cc(285)] locale_file_path.empty() 
** 5222-5222/my.app E/libEGL﹕ validate_display:255 error 3008 (EGL_BAD_DISPLAY) 
** 5222-5222/my.app E/libEGL﹕ validate_display:255 error 3008 (EGL_BAD_DISPLAY) 
** 5222-5222/my.app E/chromium﹕ [ERROR:gl_surface_egl.cc(327)] No suitable EGL configs found. 
** 5222-5222/my.app E/chromium﹕ [ERROR:gl_surface_android.cc(23)] GLSurfaceEGL::InitializeOneOff failed. 
5222-5222/my.app E/chromium﹕ [ERROR:browser_main_loop.cc(698)] GLSurface::InitializeOneOff failed 
5222-5250/my.app W/art﹕ Long monitor contention event with owner method=void android.app.SharedPreferencesImpl$1.run() from SharedPreferencesImpl.java:90 waiters=1 for 280ms 
5222-5247/my.app W/art﹕ Long monitor contention event with owner method=void java.lang.Thread.nativeCreate(java.lang.Thread, long, boolean) from Thread.java:4294967294 waiters=3 for 441ms 
5222-5231/my.app W/art﹕ Suspending all threads took: 16.275ms 
5222-5222/my.app E/DataReductionProxySettingListener﹕ No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp 
5222-5269/my.app W/AudioManagerAndroid﹕ Requires BLUETOOTH permission 
** 5222-5222/my.app I/Ads﹕ Starting ad request. 
5222-5231/my.app W/art﹕ Suspending all threads took: 9.629ms 
5222-5222/my.app I/Choreographer﹕ Skipped 41 frames! The application may be doing too much work on its main thread. 
5222-5222/my.app D/gralloc_goldfish﹕ Emulator without GPU emulation detected. 
5222-5231/my.app W/art﹕ Suspending all threads took: 140.144ms 
** 5222-5246/my.app W/GooglePlayServicesUtil﹕ Google Play services is missing. 
** 5222-5246/my.app W/GooglePlayServicesUtil﹕ Google Play services is missing. 
5222-5267/my.app W/chromium﹕ [WARNING:data_reduction_proxy_config.cc(423)] SPDY proxy OFF at startup 
5222-5222/my.app W/art﹕ Attempt to remove non-JNI local reference, dumping thread 
5222-5222/my.app W/AwContents﹕ onDetachedFromWindow called when already detached. Ignoring 
5222-5222/my.app W/art﹕ Attempt to remove non-JNI local reference, dumping thread 
5222-5222/my.app W/art﹕ Attempt to remove non-JNI local reference, dumping thread 
5222-5303/my.app A/chromium﹕ [FATAL:gl_surface_android.cc(58)] Check failed: kGLImplementationNone != GetGLImplementation() (0 vs. 0) 
5222-5303/my.app W/google-breakpad﹕ ### ### ### ### ### ### ### ### ### ### ### ### ### 
5222-5303/my.app W/google-breakpad﹕ Chrome build fingerprint: 
5222-5303/my.app W/google-breakpad﹕ 1.04 
5222-5303/my.app W/google-breakpad﹕ 5 
5222-5303/my.app W/google-breakpad﹕ 023f32a1-4862-425f-a49b-e5b1792614ed 
5222-5303/my.app W/google-breakpad﹕ ### ### ### ### ### ### ### ### ### ### ### ### ### 
5222-5303/my.app E/chromium﹕ ### WebView Version 44.0.2403.119 (code 246011900) 
5222-5303/my.app A/libc﹕ Fatal signal 6 (SIGABRT), code -6 in tid 5303 (GpuThread) 

感謝

+0

模擬器不顯示廣告 –

+0

添加你的代碼,用於展示廣告的 – USKMobility

+0

現在將增加。謝謝 – RNJ

回答

1

創建一個針對谷歌API的仿真器,而不是機器人。