我遇到了某种问题。
我尝试使用
整合Admob
原生广告(最近添加到Google Play服务中)
手册
https://developers.google.com/admob/android/native
快速入门
https://developers.google.com/admob/android/quick-start
AdView
加载的简单横幅就可以了,但是当我改为按AdLoader
加载原生广告时,我真的感到困惑。
我正在使用Idea + Gradle和Android Annotations。
这是Logcat(更新后,请看到问题的结尾):
07-13 17:12:32.260 2548-2580/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DexOpt: --- BEGIN 'ads-1439082442.jar' (bootstrap=0) ---
07-13 17:12:32.350 2548-2548/com.clockbyte.vkgroupwatcher I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-13 17:12:32.350 2548-2548/com.clockbyte.vkgroupwatcher I/Ads﹕ Starting ad request.
07-13 17:12:32.840 2548-2580/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DexOpt: --- END 'ads-1439082442.jar' (success) ---
07-13 17:12:32.840 2548-2580/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DEX prep '/data/data/com.clockbyte.vkgroupwatcher/cache/ads-1439082442.jar': unzip in 0ms, rewrite 580ms
07-13 17:12:35.100 1798-1826/com.google.android.gms I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-13 17:12:36.360 2548-2548/com.clockbyte.vkgroupwatcher I/dalvikvm﹕ Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.t.h.<init>
07-13 17:13:36.351 2548-2612/com.clockbyte.vkgroupwatcher W/Ads﹕ Timed out waiting for native ad.
07-13 17:13:36.351 2548-2613/com.clockbyte.vkgroupwatcher W/Ads﹕ Timeout when loading native ad.
java.util.concurrent.TimeoutException: CallbackFuture timed out.
at com.google.android.gms.ads.internal.util.a.a.get(SourceFile:108)
at com.google.android.gms.ads.internal.o.a.a.b(SourceFile:156)
at com.google.android.gms.ads.internal.o.a.a.call(SourceFile:70)
at com.google.android.gms.ads.internal.util.n.run(SourceFile:75)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
07-13 17:13:36.351 2548-2548/com.clockbyte.vkgroupwatcher W/Ads﹕ Failed to load ad: 2
07-13 17:13:36.351 2548-2548/com.clockbyte.vkgroupwatcher I/com.clockbyte.vkgroupwatcher.ads.AdmobFetcher﹕ Fetching Ad now
07-13 17:13:36.391 1798-1825/com.google.android.gms I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-13 17:13:36.741 2548-2548/com.clockbyte.vkgroupwatcher I/chromium﹕ [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest http://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.appcache", source: http://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.html (0)
07-13 17:13:36.751 2548-2548/com.clockbyte.vkgroupwatcher I/chromium﹕ [INFO:CONSOLE(0)] "Application Cache Checking event", source: http://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.html (0)
07-13 17:13:36.861 2548-2548/com.clockbyte.vkgroupwatcher I/chromium﹕ [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: http://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.html (0)
07-13 17:13:36.881 2548-2548/com.clockbyte.vkgroupwatcher W/Ads﹕ Failed to load ad: 0
以下是获取广告的代码(我从扩展的prefetchAds
调用方法BaseAdapter
将已加载的广告发布到ListView
)。
package com.clockbyte.vkgroupwatcher.ads;
import android.content.Context;
import android.provider.Settings;
import android.text.TextUtils;
import com.clockbyte.vkgroupwatcher.CbLog;
import com.clockbyte.vkgroupwatcher.Crypt;
import com.clockbyte.vkgroupwatcher.GroupWatcherApplication;
import com.clockbyte.vkgroupwatcher.R;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdLoader;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.formats.NativeAd;
import com.google.android.gms.ads.formats.NativeAdOptions;
import com.google.android.gms.ads.formats.NativeAppInstallAd;
import com.google.android.gms.ads.formats.NativeContentAd;
public class AdmobFetcher {
private AdLoader adLoader;
private WeakReference<Context> mContext = new WeakReference<>(null);
...
//I call this method once, just to setup AdLoader and fetch the ad.
public synchronized void prefetchAds(Context context) {
mContext = new WeakReference<>(context);
setupAds();
fetchAd();
}
private synchronized void setupAds() {
String admobUnitId = "ca-app-pub-3940256099942544/2247696110"; // the test ad unit id that is pointed in the manual
adLoader = new AdLoader.Builder(mContext.get(), admobUnitId)
.forAppInstallAd(new NativeAppInstallAd.OnAppInstallAdLoadedListener() {
@Override
public void onAppInstallAdLoaded(NativeAppInstallAd appInstallAd) {
onAdFetched(appInstallAd); // Can't get here
}
})
.forContentAd(new NativeContentAd.OnContentAdLoadedListener() {
@Override
public void onContentAdLoaded(NativeContentAd contentAd) {
onAdFetched(contentAd); // Can't get here
}
})
.withAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
// Here I got errorCode = 0 each time (kindly check Logcat)
}
})
.withNativeAdOptions(new NativeAdOptions.Builder()
// Methods in the NativeAdOptions.Builder class can be
// used here to specify individual options settings.
//.setReturnUrlsForImageAssets(true)
.build())
.build();
}
/**
* Fetches a new native ad.
*/
private synchronized void fetchAd() {
Context context = mContext.get();
if (context != null) {
adLoader.loadAd(getAdRequest()); //Fetching the ads item
} else {
mFetchFailCount++;
}
}
/**
* Setup and get an AdRequest instance
*/
private synchronized AdRequest getAdRequest() {
String deviceId = "XXXXXXXXXXXXXXX";
return new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // All emulators are added by default as test devices
.addTestDevice(deviceId)
.build();
}
...
}
该应用的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.clockbyte.vkgroupwatcher"
android:versionCode="4"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<application
android:name="GroupWatcherApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<!--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=".activities.LoginActivity_"
android:configChanges="keyboardHidden|orientation"
android:launchMode="standard"
android:noHistory="false" >
</activity>
<activity
android:name=".activities.MainContainerActivity_"
android:launchMode="standard" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.PreferencesActivity_"
android:theme="@style/SettingsTheme" >
</activity>
<activity
android:name=".activities.WatcherEditActivity_"
android:launchMode="standard" >
</activity>
<activity
android:name=".activities.AddGroupsActivity_"
android:launchMode="standard" >
</activity>
<activity
android:name=".activities.MessageDetailsActivity_"
android:launchMode="standard" >
</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" />
<service
android:name=".service.WatcherService_"
android:enabled="true" />
<receiver
android:name="com.clockbyte.vkgroupwatcher.environment.EnvironmentStateReceiver_"
android:enabled="true" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>
</application>
</manifest>
最后我的build.gradle
模块
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
} }
repositories {
jcenter()
mavenCentral()
mavenLocal() }
apply plugin: 'com.android.application' apply plugin: 'android-apt' def AAVersion = '3.3.1'
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'com.clockbyte.vkgroupwatcher'
} }
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.clockbyte.vkgroupwatcher"
minSdkVersion 11
targetSdkVersion 22
versionCode 6
versionName "1.1"
multiDexEnabled = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.loopj.android:android-async-http:1.4.7'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.jsoup:jsoup:1.8.2'
compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-appinvite:7.5.0'
compile project(':google-licensing') }
我错过了什么吗?
或Admob
此外,我尝试了将应用程序单元ID从测试更改为真实,在模拟器/设备上进行测试以及清除设备上Google Play服务的缓存数据等相同的结果。
任何帮助/想法都将受到高度赞赏......
更新
我从gradle的配置中删除了multidex模式并将buildToolsVersion
更改为最新的(22.0.1),logcat更新到问题的顶部。现在,方法fetchAd
的第一次调用失败,代码为2(超时),下一次调用失败,代码为0,如前所述。请查看更新的 Logcat
Updated2: 真实设备的日志(android api level 15):
07-14 00:23:26.985 7698-7698/com.clockbyte.vkgroupwatcher I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-14 00:23:27.015 7698-7698/com.clockbyte.vkgroupwatcher I/Ads﹕ Starting ad request.
07-14 00:23:27.225 7698-7823/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DexOpt: --- BEGIN 'ads833267715.jar' (bootstrap=0) ---
07-14 00:23:27.365 7698-7823/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DexOpt: --- END 'ads833267715.jar' (success) ---
07-14 00:23:27.365 7698-7823/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DEX prep '/data/data/com.clockbyte.vkgroupwatcher/cache/ads833267715.jar': unzip in 0ms, rewrite 139ms
07-14 00:23:36.424 7433-7443/? I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-14 00:23:36.454 7433-7863/? I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-14 00:23:36.504 7433-7863/? I/dalvikvm﹕ Could not find method android.net.ConnectivityManager.isActiveNetworkMetered, referenced from method com.google.android.gms.ads.internal.request.a.r.a
07-14 00:23:36.584 7433-7433/? I/dalvikvm﹕ Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.t.h.<init>
07-14 00:23:36.584 7433-7433/? I/dalvikvm﹕ Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.t.h.evaluateJavascript
07-14 00:23:36.594 7433-7433/? I/dalvikvm﹕ Could not find method com.google.android.gms.ads.internal.t.h.isAttachedToWindow, referenced from method com.google.android.gms.ads.internal.t.h.onDraw
07-14 00:23:36.594 7433-7433/? W/dalvikvm﹕ VFY: unable to resolve virtual method 6452: Lcom/google/android/gms/ads/internal/t/h;.isAttachedToWindow ()Z
07-14 00:23:36.624 7433-7857/? D/skia﹕ WebFrame::loadStarted (1) https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html
07-14 00:23:37.295 7433-7857/? D/skia﹕ WebFrame::loadStarted (0) gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D157010986198
07-14 00:23:37.295 7433-7433/? W/Ads﹕ JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D15701098619806543204%26seq_num%3D1%26rm%3D1%26fdz%3D-1%26adtest%3Don%26js%3Dafma-sdk-a-v7574000.7571000.1%26eid%3D46621077%252C46621098%252C318474371%26hl%3Dru%26submodel%3DHTC%2520Sensation%2520XE%2520with%2520Beats%2520Audio%2520Z715e%26gnt%3D0%26native_templates%3D1%252C2%26ma%3D0%26platform%3DHTC%26forceHttps%3Dtrue%26u_sd%3D1.5%26sp%3D0%26cnt%3D1%26native_version%3D3%26muv%3D15%26riv%3D0%26ms%3DbBaKMM241P7ZUZbIw630exH1iY80ufKc8Z12nKVbEOI4eDpWg2KlW24F0xUKsi7r1FLSD9ISfYeAdN8C_jtjpY6xx5wG5BARDyrZUgeW_qnHTavdTzBzrpSaI1-3y19EgkD3mrsTe5XMetskcd4lTidQnf63xhT8BeE9u1LAJb1pTp_N8TssVCQNtBBRk59fPAK8olxqwKJm-nDWnLngOBSH0F_dXlmb_-ZhxT0VwHw8Hv406I5dXx2jh6YAvc0kd_cJwwBfLhCXEnxqcNCgAhLJWbdnzqf2kYziboXI8BGqqPbVNRNeKqzWB149Ri-q0no25qbKdZIbT0yuMNMkgA%26mv%3D80321300.com.android.vending%26format%3D320x50_mb%26coh%3D1%26gl%3DRU%26request_id%3Dd72e3527-8d9a-4f0c-b771-18f9f922403c%26am%3D0%26native_image_orientation%3Dany%26u_w%3D360%26u_h%3D640%26msid%3Dcom.clockbyte.vkgroupwatcher%26app_name%3D6.android.com.clockbyte.vkgroupwatcher%26an%3D6.android.com.clockbyte.vkgroupwatcher%26net%3Dwi%26u_audio%3D3%26u_so%3Dp%26preqs%3D0%26support_transparent_background%3Dtrue%26pimp%3D0%26currts%3D4989768%26pclick%3D0%26basets%3D4989768%26output%3Dhtml%26region%3Dmobile_app%26u_tz%3D180%26client_sdk%3D1%26ex%3D1%26client%3Dca-app-pub-3940256099942544%26slotname%3D6300978111%26gsb%3Dwi%26bisch%3Dtrue%26blev%3D0.55%26cans%3D-1%26canm%3Dfalse%26caps%3DinlineVideo_interactiveVideo_mraid1_mraid2_th_autoplay_mediation_transparentBackground_sdkAdmobApiForAds_di%26_efs%3Dfalse%26blockAutoClicks%3D0%26forceGmsDoritos%3D1%26tcar%3D46%26jsv%3D176%26urll%3D1435&base_uri=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma&use_webview_loadurl=0&enable_auto_click_protection=0&google.afma.Notify_dt=1436822617303.
(null:1)
07-14 00:23:37.295 7433-7433/? W/Web Console﹕ The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D15701098619806543204%26seq_num%3D1%26rm%3D1%26fdz%3D-1%26adtest%3Don%26js%3Dafma-sdk-a-v7574000.7571000.1%26eid%3D46621077%252C46621098%252C318474371%26hl%3Dru%26submodel%3DHTC%2520Sensation%2520XE%2520with%2520Beats%2520Audio%2520Z715e%26gnt%3D0%26native_templates%3D1%252C2%26ma%3D0%26platform%3DHTC%26forceHttps%3Dtrue%26u_sd%3D1.5%26sp%3D0%26cnt%3D1%26native_version%3D3%26muv%3D15%26riv%3D0%26ms%3DbBaKMM241P7ZUZbIw630exH1iY80ufKc8Z12nKVbEOI4eDpWg2KlW24F0xUKsi7r1FLSD9ISfYeAdN8C_jtjpY6xx5wG5BARDyrZUgeW_qnHTavdTzBzrpSaI1-3y19EgkD3mrsTe5XMetskcd4lTidQnf63xhT8BeE9u1LAJb1pTp_N8TssVCQNtBBRk59fPAK8olxqwKJm-nDWnLngOBSH0F_dXlmb_-ZhxT0VwHw8Hv406I5dXx2jh6YAvc0kd_cJwwBfLhCXEnxqcNCgAhLJWbdnzqf2kYziboXI8BGqqPbVNRNeKqzWB149Ri-q0no25qbKdZIbT0yuMNMkgA%26mv%3D80321300.com.android.vending%26format%3D320x50_mb%26coh%3D1%26gl%3DRU%26request_id%3Dd72e3527-8d9a-4f0c-b771-18f9f922403c%26am%3D0%26native_image_orientation%3Dany%26u_w%3D360%26u_h%3D640%26msid%3Dcom.clockbyte.vkgroupwatcher%26app_name%3D6.android.com.clockbyte.vkgroupwatcher%26an%3D6.android.com.clockbyte.vkgroupwatcher%26net%3Dwi%26u_audio%3D3%26u_so%3Dp%26preqs%3D0%26support_transparent_background%3Dtrue%26pimp%3D0%26currts%3D4989768%26pclick%3D0%26basets%3D4989768%26output%3Dhtml%26region%3Dmobile_app%26u_tz%3D180%26client_sdk%3D1%26ex%3D1%26client%3Dca-app-pub-3940256099942544%26slotname%3D6300978111%26gsb%3Dwi%26bisch%3Dtrue%26blev%3D0.55%26cans%3D-1%26canm%3Dfalse%26caps%3DinlineVideo_interactiveVideo_mraid1_mraid2_th_autoplay_mediation_transparentBackground_sdkAdmobApiForAds_di%26_efs%3Dfalse%26blockAutoClicks%3D0%26forceGmsDoritos%3D1%26tcar%3D46%26jsv%3D176%26urll%3D1435&base_uri=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma&use_webview_loadurl=0&enable_auto_click_protection=0&google.afma.Notify_dt=1436822617303.
at null:1
07-14 00:23:37.335 7433-7857/? D/skia﹕ WebFrame::loadStarted (0) gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D157010986198
07-14 00:23:37.345 7433-7433/? W/Ads﹕ JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D15701098619806543204%26seq_num%3D1%26rm%3D1%26fdz%3D-1%26adtest%3Don%26js%3Dafma-sdk-a-v7574000.7571000.1%26eid%3D46621077%252C46621098%252C318474371%26hl%3Dru%26submodel%3DHTC%2520Sensation%2520XE%2520with%2520Beats%2520Audio%2520Z715e%26gnt%3D0%26native_templates%3D1%252C2%26ma%3D0%26platform%3DHTC%26forceHttps%3Dtrue%26u_sd%3D1.5%26sp%3D0%26cnt%3D1%26native_version%3D3%26muv%3D15%26riv%3D0%26ms%3DbBaKMM241P7ZUZbIw630exH1iY80ufKc8Z12nKVbEOI4eDpWg2KlW24F0xUKsi7r1FLSD9ISfYeAdN8C_jtjpY6xx5wG5BARDyrZUgeW_qnHTavdTzBzrpSaI1-3y19EgkD3mrsTe5XMetskcd4lTidQnf63xhT8BeE9u1LAJb1pTp_N8TssVCQNtBBRk59fPAK8olxqwKJm-nDWnLngOBSH0F_dXlmb_-ZhxT0VwHw8Hv406I5dXx2jh6YAvc0kd_cJwwBfLhCXEnxqcNCgAhLJWbdnzqf2kYziboXI8BGqqPbVNRNeKqzWB149Ri-q0no25qbKdZIbT0yuMNMkgA%26mv%3D80321300.com.android.vending%26format%3D320x50_mb%26coh%3D1%26gl%3DRU%26request_id%3Dd72e3527-8d9a-4f0c-b771-18f9f922403c%26am%3D0%26native_image_orientation%3Dany%26u_w%3D360%26u_h%3D640%26msid%3Dcom.clockbyte.vkgroupwatcher%26app_name%3D6.android.com.clockbyte.vkgroupwatcher%26an%3D6.android.com.clockbyte.vkgroupwatcher%26net%3Dwi%26u_audio%3D3%26u_so%3Dp%26preqs%3D0%26support_transparent_background%3Dtrue%26pimp%3D0%26currts%3D4989768%26pclick%3D0%26basets%3D4989768%26output%3Dhtml%26region%3Dmobile_app%26u_tz%3D180%26client_sdk%3D1%26ex%3D1%26client%3Dca-app-pub-3940256099942544%26slotname%3D6300978111%26gsb%3Dwi%26bisch%3Dtrue%26blev%3D0.55%26cans%3D-1%26canm%3Dfalse%26caps%3DinlineVideo_interactiveVideo_mraid1_mraid2_th_autoplay_mediation_transparentBackground_sdkAdmobApiForAds_di%26_efs%3Dfalse%26blockAutoClicks%3D0%26forceGmsDoritos%3D1%26tcar%3D46%26jsv%3D176%26urll%3D1435&base_uri=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma&use_webview_loadurl=0&enable_auto_click_protection=0&google.afma.Notify_dt=1436822617303.
(null:1)
07-14 00:23:37.345 7433-7433/? W/Web Console﹕ The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D15701098619806543204%26seq_num%3D1%26rm%3D1%26fdz%3D-1%26adtest%3Don%26js%3Dafma-sdk-a-v7574000.7571000.1%26eid%3D46621077%252C46621098%252C318474371%26hl%3Dru%26submodel%3DHTC%2520Sensation%2520XE%2520with%2520Beats%2520Audio%2520Z715e%26gnt%3D0%26native_templates%3D1%252C2%26ma%3D0%26platform%3DHTC%26forceHttps%3Dtrue%26u_sd%3D1.5%26sp%3D0%26cnt%3D1%26native_version%3D3%26muv%3D15%26riv%3D0%26ms%3DbBaKMM241P7ZUZbIw630exH1iY80ufKc8Z12nKVbEOI4eDpWg2KlW24F0xUKsi7r1FLSD9ISfYeAdN8C_jtjpY6xx5wG5BARDyrZUgeW_qnHTavdTzBzrpSaI1-3y19EgkD3mrsTe5XMetskcd4lTidQnf63xhT8BeE9u1LAJb1pTp_N8TssVCQNtBBRk59fPAK8olxqwKJm-nDWnLngOBSH0F_dXlmb_-ZhxT0VwHw8Hv406I5dXx2jh6YAvc0kd_cJwwBfLhCXEnxqcNCgAhLJWbdnzqf2kYziboXI8BGqqPbVNRNeKqzWB149Ri-q0no25qbKdZIbT0yuMNMkgA%26mv%3D80321300.com.android.vending%26format%3D320x50_mb%26coh%3D1%26gl%3DRU%26request_id%3Dd72e3527-8d9a-4f0c-b771-18f9f922403c%26am%3D0%26native_image_orientation%3Dany%26u_w%3D360%26u_h%3D640%26msid%3Dcom.clockbyte.vkgroupwatcher%26app_name%3D6.android.com.clockbyte.vkgroupwatcher%26an%3D6.android.com.clockbyte.vkgroupwatcher%26net%3Dwi%26u_audio%3D3%26u_so%3Dp%26preqs%3D0%26support_transparent_background%3Dtrue%26pimp%3D0%26currts%3D4989768%26pclick%3D0%26basets%3D4989768%26output%3Dhtml%26region%3Dmobile_app%26u_tz%3D180%26client_sdk%3D1%26ex%3D1%26client%3Dca-app-pub-3940256099942544%26slotname%3D6300978111%26gsb%3Dwi%26bisch%3Dtrue%26blev%3D0.55%26cans%3D-1%26canm%3Dfalse%26caps%3DinlineVideo_interactiveVideo_mraid1_mraid2_th_autoplay_mediation_transparentBackground_sdkAdmobApiForAds_di%26_efs%3Dfalse%26blockAutoClicks%3D0%26forceGmsDoritos%3D1%26tcar%3D46%26jsv%3D176%26urll%3D1435&base_uri=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma&use_webview_loadurl=0&enable_auto_click_protection=0&google.afma.Notify_dt=1436822617303.
at null:1
07-14 00:23:37.365 7433-7433/? W/Ads﹕ JS: The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
(null:1)
07-14 00:23:37.365 7433-7433/? W/Web Console﹕ The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
at null:1
07-14 00:23:38.155 7433-7857/? D/skia﹕ WebFrame::loadStarted (1) about:blank
07-14 00:23:38.276 7698-7698/com.clockbyte.vkgroupwatcher I/dalvikvm﹕ Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.t.h.<init>
07-14 00:23:38.286 7698-7698/com.clockbyte.vkgroupwatcher I/dalvikvm﹕ Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.t.h.evaluateJavascript
07-14 00:23:38.286 7698-7698/com.clockbyte.vkgroupwatcher I/dalvikvm﹕ Could not find method com.google.android.gms.ads.internal.t.h.isAttachedToWindow, referenced from method com.google.android.gms.ads.internal.t.h.onDraw
07-14 00:23:38.286 7698-7698/com.clockbyte.vkgroupwatcher W/dalvikvm﹕ VFY: unable to resolve virtual method 6452: Lcom/google/android/gms/ads/internal/t/h;.isAttachedToWindow ()Z
07-14 00:23:38.336 7698-7827/com.clockbyte.vkgroupwatcher D/skia﹕ WebFrame::loadStarted (1) https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.html
07-14 00:23:38.916 7698-7827/com.clockbyte.vkgroupwatcher D/skia﹕ WebFrame::loadStarted (0) gmsg://mobileads.google.com/nativeAdPreProcess?failure=true&google.afma.Notify_dt=1436822618925
07-14 00:23:38.926 7698-7698/com.clockbyte.vkgroupwatcher W/Ads﹕ JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/nativeAdPreProcess?failure=true&google.afma.Notify_dt=1436822618925.
(null:1)
07-14 00:23:38.926 7698-7698/com.clockbyte.vkgroupwatcher W/Web Console﹕ The page at about:blank displayed insecure content from gmsg://mobileads.google.com/nativeAdPreProcess?failure=true&google.afma.Notify_dt=1436822618925.
at null:1
07-14 00:23:38.946 7698-7698/com.clockbyte.vkgroupwatcher W/Ads﹕ Failed to load ad: 0
更新3 我试图仅获取内容广告(通过评论AdLoader.Builder中的相应块),如@RedBrogdon所建议的那样。这是日志
08-17 12:07:16.806 4918-5025/com.engineers.admobtest54321 D/dalvikvm﹕ DexOpt: --- BEGIN 'ads-973066727.jar' (bootstrap=0) ---
08-17 12:07:16.926 4918-5025/com.engineers.admobtest54321 D/dalvikvm﹕ DexOpt: --- END 'ads-973066727.jar' (success) ---
08-17 12:07:16.926 4918-5025/com.engineers.admobtest54321 D/dalvikvm﹕ DEX prep '/data/data/com.engineers.admobtest54321/cache/ads-973066727.jar': unzip in 0ms, rewrite 123ms
08-17 12:07:16.946 4918-4918/com.engineers.admobtest54321 I/Ads﹕ Starting ad request.
08-17 12:07:17.566 4918-5055/com.engineers.admobtest54321 I/Ads﹕ Trying mediation network:
08-17 12:07:17.576 4918-4918/com.engineers.admobtest54321 I/Ads﹕ Instantiating mediation adapter: com.google.DummyAdapter
08-17 12:07:17.576 4918-4918/com.engineers.admobtest54321 W/Ads﹕ Could not instantiate mediation adapter: com.google.DummyAdapter. com.google.DummyAdapter
08-17 12:07:17.576 4918-5055/com.engineers.admobtest54321 I/Ads﹕ No fill from any mediation ad networks.
08-17 12:07:17.576 4918-4918/com.engineers.admobtest54321 W/Ads﹕ Failed to load ad: 3
答案 0 :(得分:10)
注意:目前,发布商不应将addTestDevice方法用于原生广告请求。使用上述广告单元ID以及对addTestDevice的调用是当前测试的最佳做法。
请尝试删除对addTestDevice(deviceId)
的调用。我有同样的问题,并在我完成后开始工作。
答案 1 :(得分:0)
由于Native Advanced仍处于测试阶段,您必须使用https://support.google.com/admob/contact/account_setup?rd=1
申请注册答案 2 :(得分:0)
我认为这是一个尺寸问题 请尝试使用Native Express ID:
ca-app-pub-3940256099942544/2793859312(小模板)
答案 3 :(得分:0)
可能无法帮助所有人,但不要忘记关闭所有类型的 ADBLOCKER。
我配置了一个广告拦截器 DNS,我花了几个小时终于找到了 :D