以前,我的应用是在Playstore中启动的,但是由于插页式广告违反了政策,因此Google关闭了广告。
现在,我再次更新应用程序,删除了插页式广告,仅使用横幅广告。在admob中创建了另一个应用ID,并在项目中使用了这些ID,但显示“广告无法加载”的错误
我也尝试使用其他应用的横幅ID,但它们无法正常工作。 我用不同的软件包名称重新创建了该应用程序,但这也没有解决我的问题。我尝试了每种组合。但是我没有得到结果。
代码
JAVA.
setContentView(R.layout.activity_home);
MobileAds.initialize(this, "ca-app-pub-2392231950998190~1823255001");
AdView adview = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adview.loadAd(adRequest);
adview.setAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
Toast.makeText(getApplicationContext(), "Ad Failed to load", Toast.LENGTH_SHORT).show();
// Code to be executed when an ad request fails.
}
});
清单:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-2392231950998190~1823255001"/>
Logcat:-
07-19 21:26:23.097 1441-1452/? E/WakeGestureListener: cancelWakeUpTrigger
07-19 21:26:23.099 1441-1452/? E/WakeGestureListener: cancelWakeUpTriggerCANCELED
07-19 21:26:23.099 1441-1452/? E/WakeGestureListener: cancelWakeUpTrigger
07-19 21:26:23.099 1441-1452/? E/WindowManager: Cancel all lift to wake WakeUp
07-19 21:26:23.099 1441-1452/? E/WakeGestureListener: requestWakeUpTrigger
07-19 21:26:23.107 805-1906/? E/SSC_HAL: activate:50, [SSC_HAL] oem_sensor activate.
07-19 21:26:23.107 1441-1452/? E/WakeGestureListener: requestWakeUpTriggerREQUESTED
07-19 21:26:23.107 1441-1452/? E/WindowManager: lift to wake preEnable WakeUp
07-19 21:26:23.139 4376-4376/? E/RegisteredServicesCache: Next Tag=services
07-19 21:26:23.140 4376-4376/? E/RegisteredServicesCache: installedServices no uidString
07-19 21:26:23.140 4376-4376/? E/RegisteredServicesCache: installedServices contains uidString : 10092
07-19 21:26:23.140 4376-4376/? E/RegisteredServicesCache: 1invalidateCache:WriteServiceStateToFile
07-19 21:26:23.140 4376-4376/? E/RegisteredServicesCache: Writing service state Data Always
07-19 21:26:23.140 4376-4376/? E/RegisteredServicesCache: component namecom.google.android.apps.walletnfcrel/com.google.commerce.tapandpay.android.transit.tap.service.TransitHceService
07-19 21:26:23.140 4376-4376/? E/RegisteredServicesCache: component namecom.google.android.apps.walletnfcrel/com.google.commerce.tapandpay.android.hce.service.ValuableApduService
07-19 21:26:23.156 18607-18666/? E/PBSessionCacheImpl: sessionId[81836014808287019] not persisted.
07-19 21:26:23.209 16976-16976/? E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-19 21:26:23.209 16976-16976/? E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-19 21:26:23.252 30212-30243/? E/audio_route: Path: listen-cpe-handset-mic, length: 4
07-19 21:26:23.252 30212-30243/? E/audio_route: id=0: ctl=MAD Input
07-19 21:26:23.252 30212-30243/? E/audio_route: id=0 value=1
07-19 21:26:23.252 30212-30243/? E/audio_route: id=1: ctl=MAD_SEL MUX
07-19 21:26:23.252 30212-30243/? E/audio_route: id=0 value=0
07-19 21:26:23.252 30212-30243/? E/audio_route: id=2: ctl=MAD_INP MUX
07-19 21:26:23.252 30212-30243/? E/audio_route: id=0 value=0
07-19 21:26:23.252 30212-30243/? E/audio_route: id=3: ctl=MAD_CPE1 Switch
07-19 21:26:23.252 30212-30243/? E/audio_route: id=0 value=1
07-19 21:26:23.262 1441-1496/? E/libprocessgroup: Error encountered killing process cgroup uid 99804 pid 18077: No such file or directory
07-19 21:26:23.352 17214-17214/? E/adbd: failed to connect to socket 'localabstract:com.shrivishnukrishna.bsc': Connection refused
07-19 21:26:25.410 4376-4376/? E/RegisteredServicesCache: Next Tag=services
07-19 21:26:25.410 4376-4376/? E/RegisteredServicesCache: installedServices no uidString
07-19 21:26:25.410 4376-4376/? E/RegisteredServicesCache: installedServices contains uidString : 10092
07-19 21:26:25.410 4376-4376/? E/RegisteredServicesCache: 1invalidateCache:WriteServiceStateToFile
07-19 21:26:25.410 4376-4376/? E/RegisteredServicesCache: Writing service state Data Always
07-19 21:26:25.412 4376-4376/? E/RegisteredServicesCache: component namecom.google.android.apps.walletnfcrel/com.google.commerce.tapandpay.android.transit.tap.service.TransitHceService
07-19 21:26:25.412 4376-4376/? E/RegisteredServicesCache: component namecom.google.android.apps.walletnfcrel/com.google.commerce.tapandpay.android.hce.service.ValuableApduService
07-19 21:26:25.735 1441-3343/? E/ANDR-PERF-JNI: com_qualcomm_qtiperformance_native_perf_io_prefetch_start
07-19 21:26:25.736 815-815/? E/ANDR-IOP: IOP HAL: Received pkg_name = com.shrivishnukrishna.bsc pid = -1
07-19 21:26:25.739 815-874/? E/ANDR-IOP: io prefetch is disabled
07-19 21:26:25.798 1441-3343/? E/WakeGestureListener: cancelWakeUpTrigger
07-19 21:26:25.799 1441-3343/? E/WakeGestureListener: cancelWakeUpTriggerCANCELED
07-19 21:26:25.799 1441-3343/? E/WakeGestureListener: cancelWakeUpTrigger
07-19 21:26:25.799 1441-3343/? E/WindowManager: Cancel all lift to wake WakeUp
07-19 21:26:25.799 1441-3343/? E/WakeGestureListener: requestWakeUpTrigger
07-19 21:26:25.803 805-1906/? E/SSC_HAL: activate:50, [SSC_HAL] oem_sensor activate.
07-19 21:26:25.803 1441-3343/? E/WakeGestureListener: requestWakeUpTriggerREQUESTED
07-19 21:26:25.803 1441-3343/? E/WindowManager: lift to wake preEnable WakeUp
07-19 21:26:26.106 18255-18255/? E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-19 21:26:26.106 18255-18255/? E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-19 21:26:31.103 1441-3343/? E/ANDR-PERF-JNI: com_qualcomm_qtiperformance_native_perf_io_prefetch_start
07-19 21:26:31.103 815-815/? E/ANDR-IOP: IOP HAL: Received pkg_name = com.shrivishnukrishna.bsc pid = -1
07-19 21:26:31.105 815-874/? E/ANDR-IOP: io prefetch is disabled
07-19 21:26:31.120 1441-2938/? E/WakeGestureListener: cancelWakeUpTrigger
07-19 21:26:31.121 1441-2938/? E/WakeGestureListener: cancelWakeUpTriggerCANCELED
07-19 21:26:31.121 1441-2938/? E/WakeGestureListener: cancelWakeUpTrigger
07-19 21:26:31.121 1441-2938/? E/WindowManager: Cancel all lift to wake WakeUp
07-19 21:26:31.121 1441-2938/? E/WakeGestureListener: requestWakeUpTrigger
07-19 21:26:31.124 805-805/? E/SSC_HAL: activate:50, [SSC_HAL] oem_sensor activate.
07-19 21:26:31.125 1441-2938/? E/WakeGestureListener: requestWakeUpTriggerREQUESTED
07-19 21:26:31.125 1441-2938/? E/WindowManager: lift to wake preEnable WakeUp
07-19 21:26:31.421 18314-18314/? E/dboxed_process: Not starting debugger since process cannot load the jdwp agent.
07-19 21:26:31.804 18255-18255/com.shrivishnukrishna.bsc E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-19 21:26:31.804 18255-18255/com.shrivishnukrishna.bsc E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
答案 0 :(得分:0)
新创建的广告单元需要一些时间才能显示出来。当广告不可用时,此错误是正常现象。
使用演示广告ID测试应用。如果可以正常运行,请使用实际的广告ID发布应用。稍后会弹出。
答案 1 :(得分:0)
在关闭应用之前,是否较早投放了广告? 另外,请确保您已在Admob中添加了付款信息,否则将不会显示广告。请注意,取决于位置,Admob最多可能需要几个小时才能投放广告。