我无法在我的活动中加载Google横幅广告。我添加了developer.google.com中描述的所有权限和标记,并且还在StackOverflow中引用了其他问题。
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("477359CAFFxxxxxxxxxxxxxxxxxxx").build();
enter code hereadView.loadAd(adRequest);{}
“我的logcat输出:我添加了所有权限和元标记”
04-12 10:07:18.753: W/ResourcesManager(17370): Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
04-12 10:07:18.753: W/ResourcesManager(17370): Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
04-12 10:07:18.846: I/WebViewFactory(17370): Loading com.google.android.webview version 40 (1832189-arm) (code 424501)
04-12 10:07:18.869: I/LibraryLoader(17370): Time to load native libraries: 3 ms (timestamps 5621-5624)
04-12 10:07:18.869: I/LibraryLoader(17370): Expected native library version number "",actual native library version number ""
04-12 10:07:18.875: V/WebViewChromiumFactoryProvider(17370): Binding Chromium to main looper Looper (main, tid 1) {28944cc5}
04-12 10:07:18.876: I/LibraryLoader(17370): Expected native library version number "",actual native library version number ""
04-12 10:07:18.876: I/chromium(17370): [INFO:library_loader_hooks.cc(108)] Chromium logging enabled: level = 0, default verbosity = 0
04-12 10:07:18.883: I/BrowserStartupController(17370): Initializing chromium process, singleProcess=true
04-12 10:07:18.884: W/art(17370): Attempt to remove local handle scope entry from IRT, ignoring
04-12 10:07:18.892: W/chromium(17370): [WARNING:resource_bundle.cc(304)] locale_file_path.empty()
04-12 10:07:18.892: W/AudioManagerAndroid(17370): Requires BLUETOOTH permission
04-12 10:07:18.893: I/chromium(17370): [INFO:aw_browser_main_parts.cc(63)] Load from apk succesful, fd=36 off=49196 len=3229
04-12 10:07:18.894: I/chromium(17370): [INFO:aw_browser_main_parts.cc(76)] Loading webviewchromium.pak from, fd:37 off:390788 len:1143511
04-12 10:07:18.899: I/Adreno-EGL(17370): <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 01/14/15, ab0075f, Id3510ff6dc
04-12 10:07:18.951: I/Ads(17370): Starting ad request.
04-12 10:07:18.952: I/Ads(17370): Use AdRequest.Builder.addTestDevice("F9D483C5C3943E9EFDC31D1B4C183CF8") to get test ads on this device.
04-12 10:07:18.961: D/OpenGLRenderer(17370): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
04-12 10:07:18.967: D/Atlas(17370): Validating map...
04-12 10:07:19.000: I/OpenGLRenderer(17370): Initialized EGL, version 1.4
04-12 10:07:19.003: D/OpenGLRenderer(17370): Enabling debug mode 0
04-12 10:07:19.050: I/Ads(17370): CsiReporterFactory: CSI is not enabled. No CSI reporter created.
04-12 10:07:21.086: W/Ads(17370): There was a problem getting an ad response. ErrorCode: 0
04-12 10:07:21.110: W/chromium(17370): [WARNING:data_reduction_proxy_settings.cc(328)] SPDY proxy OFF at startup
04-12 10:07:21.120: W/art(17370): Attempt to remove local handle scope entry from IRT, ignoring
04-12 10:07:21.124: W/AwContents(17370): onDetachedFromWindow called when already detached. Ignoring`enter code here`
04-12 10:07:21.140: W/Ads(17370): Failed to load ad: 0
答案 0 :(得分:4)
我不得不遇到同样的问题。我被告知我的admob帐户没有加载广告,因为我还没有创建付款帐户。确保您在admob页面上创建了一个付款帐户。
答案 1 :(得分:2)
使用google开发者网站推荐的此代码来测试横幅广告
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest request = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // All emulators
.addTestDevice("AC98C820A50B4AD8A2106EDE96FB87D4") // My Galaxy Nexus test phone
.build();
mAdView.loadAd(request);
这是完整的文档,如何在android studio click here
中执行此操作您可能已经解决了问题,但它可能对其他人有所帮助。我的建议是:
答案 2 :(得分:1)
更改您的代码如下:
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("F9D483C5C3943E9EFDC31D1B4C183CF8")
.build();
adView.loadAd(adRequest);
确保您已导入Google Play服务库,并在布局文件中添加了正确的ads:adUnitId
。
答案 3 :(得分:1)
卸载了Google Play服务更新,广告正在运行。