简体   繁体   English

点击测试广告(横幅广告或非页内广告)会使android应用崩溃

[英]clicking on test ads(banner or interstitial) crashes android app

I have added Admob banner and interstitial ads in my application(at different places). 我在我的应用程序中(不同位置)添加了Admob标语和插页式广告。 To test if the ads work fine I added my test deviceId while making ad request as below, 为了测试广告能否正常运行,我在发出广告请求时添加了我的测试deviceId,如下所示,

        AdRequest adRequest = new AdRequest.Builder().addTestDevice("*********...").build();
        adView.loadAd(adRequest);

The test ads are coming as expected, however when I click on the test ads, it crashes the application. 测试广告按预期来了,但是当我单击测试广告时,它使应用程序崩溃。 Is it normal? 正常吗

The error log, although in similar line, changes slightly(the activity name) with the change in the test ads, as below, 错误日志虽然在相似的行中,但随着测试广告的变化而​​略有变化(活动名称),如下所示,

        android.content.ActivityNotFoundException: Unable to find explicit activity class {com.mobeam.barcodeService/com.google.android.gms.ads.AdActivity}; have you declared this activity in your AndroidManifest.xml?
        08-25 17:10:58.276: W/System.err(27595):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1648)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1442)
        at android.app.Activity.startActivityForResult(Activity.java:3511)
        at android.app.Activity.startActivityForResult(Activity.java:3472)
        at android.app.Activity.startActivity(Activity.java:3714)
        at android.app.Activity.startActivity(Activity.java:3682)
        at agl.startActivity(SourceFile:71)
        at acl.a(SourceFile:120)
        at agm.a(SourceFile:233)
        at agm.a(SourceFile:165)
        at abl.a(SourceFile:102)
        at agm.a(SourceFile:377)
        at agm.shouldOverrideUrlLoading(SourceFile:293)
        at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:293)
        at com.android.org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:96)
        at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
        at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:157)
        at android.app.ActivityThread.main(ActivityThread.java:5356)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
        at dalvik.system.NativeStart.main(Native Method)

I am using new Admob and the app is signed using debug key. 我正在使用新的Admob,并且该应用使用调试密钥进行了签名。 Can I assume that in release mode it will work as expected? 我可以假设在发布模式下它将按预期工作吗? if not then how to fix this? 如果没有,那么如何解决呢?

make sure you have declared this in your AndroidManfiest.xml 确保您已在AndroidManfiest.xml中声明了这一点

<activity
    android:name="com.google.android.gms.ads.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

Then you should be able to click on the ad and it shouldn't crash. 然后,您应该可以点击广告,并且它不会崩溃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM