Admob 的 BannerSample 不起作用
BannerSample from Admob doesn't work
我尝试 运行 来自 AdMob 的 BannerSample。所以我导入它,添加 google-play-services-lib 和 android-support-v7-appcompat。我 运行 它,但横幅没有出现。怎么了?
Logcat 是:
02-02 15:29:55.211: W/GooglePlayServicesUtil(1439): Google Play services is missing.
02-02 15:29:55.481: W/GooglePlayServicesUtil(1439): Google Play services is missing.
02-02 15:29:55.511: V/WebViewChromium(1439): Binding Chromium to the main looper Looper (main, tid 1) {b2cd2c10}
02-02 15:29:55.551: I/chromium(1439): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
02-02 15:29:55.591: I/BrowserProcessMain(1439): Initializing chromium process, renderers=0
02-02 15:29:55.881: W/chromium(1439): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
02-02 15:29:55.931: D/(1439): HostConnection::get() New Host Connection established 0xb799d900, tid 1439
02-02 15:29:56.501: I/Ads(1439): Starting ad request.
02-02 15:29:56.581: I/Ads(1439): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad.
02-02 15:29:57.471: W/EGL_emulation(1439): eglSurfaceAttrib not implemented
02-02 15:29:57.521: D/OpenGLRenderer(1439): Enabling debug mode 0
02-02 15:29:57.901: D/dalvikvm(1439): GC_FOR_ALLOC freed 260K, 11% free 2951K/3284K, paused 99ms, total 107ms
02-02 15:29:58.961: D/dalvikvm(1439): DexOpt: --- BEGIN 'ads473553843.jar' (bootstrap=0) ---
02-02 15:29:59.731: D/dalvikvm(1439): DexOpt: --- END 'ads473553843.jar' (success) ---
02-02 15:29:59.741: D/dalvikvm(1439): DEX prep '/data/data/com.google.example.gms.ads.banner/cache/ads473553843.jar': unzip in 4ms, rewrite 777ms
02-02 15:30:02.331: D/dalvikvm(1439): GC_FOR_ALLOC freed 166K, 8% free 3022K/3284K, paused 69ms, total 74ms
02-02 15:30:07.401: I/chromium(1439): [INFO:CONSOLE(0)] "Creating 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)
02-02 15:30:07.411: I/chromium(1439): [INFO:CONSOLE(0)] "Application Cache Checking event", source: https: / /googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
02-02 15:30:08.961: D/dalvikvm(1439): GC_FOR_ALLOC freed 187K, 8% free 3348K/3608K, paused 79ms, total 90ms
02-02 15:30:12.401: W/Ads(1439): There was a problem getting an ad response. ErrorCode: 0
02-02 15:30:12.721: W/Ads(1439): Failed to load ad: 0
02-02 15:30:14.801: W/chromium(1439): [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=1422909014671
我的问题已通过在模拟器上安装 Google API 得到解决。我在 SDK Manager 上选择它并安装:
然后在虚拟设备管理器中编辑模拟器设置:
我尝试 运行 来自 AdMob 的 BannerSample。所以我导入它,添加 google-play-services-lib 和 android-support-v7-appcompat。我 运行 它,但横幅没有出现。怎么了?
Logcat 是:
02-02 15:29:55.211: W/GooglePlayServicesUtil(1439): Google Play services is missing.
02-02 15:29:55.481: W/GooglePlayServicesUtil(1439): Google Play services is missing.
02-02 15:29:55.511: V/WebViewChromium(1439): Binding Chromium to the main looper Looper (main, tid 1) {b2cd2c10}
02-02 15:29:55.551: I/chromium(1439): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
02-02 15:29:55.591: I/BrowserProcessMain(1439): Initializing chromium process, renderers=0
02-02 15:29:55.881: W/chromium(1439): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
02-02 15:29:55.931: D/(1439): HostConnection::get() New Host Connection established 0xb799d900, tid 1439
02-02 15:29:56.501: I/Ads(1439): Starting ad request.
02-02 15:29:56.581: I/Ads(1439): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad.
02-02 15:29:57.471: W/EGL_emulation(1439): eglSurfaceAttrib not implemented
02-02 15:29:57.521: D/OpenGLRenderer(1439): Enabling debug mode 0
02-02 15:29:57.901: D/dalvikvm(1439): GC_FOR_ALLOC freed 260K, 11% free 2951K/3284K, paused 99ms, total 107ms
02-02 15:29:58.961: D/dalvikvm(1439): DexOpt: --- BEGIN 'ads473553843.jar' (bootstrap=0) ---
02-02 15:29:59.731: D/dalvikvm(1439): DexOpt: --- END 'ads473553843.jar' (success) ---
02-02 15:29:59.741: D/dalvikvm(1439): DEX prep '/data/data/com.google.example.gms.ads.banner/cache/ads473553843.jar': unzip in 4ms, rewrite 777ms
02-02 15:30:02.331: D/dalvikvm(1439): GC_FOR_ALLOC freed 166K, 8% free 3022K/3284K, paused 69ms, total 74ms
02-02 15:30:07.401: I/chromium(1439): [INFO:CONSOLE(0)] "Creating 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)
02-02 15:30:07.411: I/chromium(1439): [INFO:CONSOLE(0)] "Application Cache Checking event", source: https: / /googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
02-02 15:30:08.961: D/dalvikvm(1439): GC_FOR_ALLOC freed 187K, 8% free 3348K/3608K, paused 79ms, total 90ms
02-02 15:30:12.401: W/Ads(1439): There was a problem getting an ad response. ErrorCode: 0
02-02 15:30:12.721: W/Ads(1439): Failed to load ad: 0
02-02 15:30:14.801: W/chromium(1439): [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=1422909014671
我的问题已通过在模拟器上安装 Google API 得到解决。我在 SDK Manager 上选择它并安装:
然后在虚拟设备管理器中编辑模拟器设置: