Adwhirl 与 Admob java.lang.NosuchMethodError:com.google.ads.AdView.destroy

发布于 2024-12-20 05:14:35 字数 607 浏览 2 评论 0原文

我正在将 adwhirl 与 admob 一起使用。广告出现了,但我在日志中收到此异常 java.lang.NosuchMethodError:com.google.ads.AdView.destroy 我不明白为什么.. 我在我的活动中使用 adwhirl 布局来请求广告..

LinearLayout adLayout = (LinearLayout) findViewById(R.id.ads);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "---------");
RelativeLayout.LayoutParams adWhirlLayoutParams = new 
    RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
                                LayoutParams.WRAP_CONTENT);
adLayout.addView(adWhirlLayout, adWhirlLayoutParams);
adLayout.invalidate();

并且我只是使用其他 AdNw 的 SDK,在清单中声明它们 这是请求广告的正确方式吗???

i'm using adwhirl with admob..The ads appears but i'm getting this exception in the log
java.lang.NosuchMethodError:com.google.ads.AdView.destroy
i don't understand why ..
i'm using adwhirl layout in my activites to request the ads..

LinearLayout adLayout = (LinearLayout) findViewById(R.id.ads);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "---------");
RelativeLayout.LayoutParams adWhirlLayoutParams = new 
    RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
                                LayoutParams.WRAP_CONTENT);
adLayout.addView(adWhirlLayout, adWhirlLayoutParams);
adLayout.invalidate();

and i'm just using the SDKs for the other AdNw ,declaring them in the manifest
is it the right way to request Ads ???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傻比既视感 2024-12-27 05:14:35

AdMob Adapter 在销毁时会调用 destroy 方法。如果您的应用程序中包含 AdMob SDK,则应该存在该方法。确保您拥有最新版本 (4.3.1) 的 Google AdMob SDK 并且您已将其包含在您的应用程序中。

另外,这就是您在清单中声明 AdMob 的 AdActivity 的方式吗?

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

最后,我不知道它是否与此问题有关,但您定义了一些 RelativeLayout 参数,但将其添加到 LinearLayout 中。您实际上根本不需要指定这些参数。这应该足够了:

LinearLayout adLayout = (LinearLayout) findViewById(R.id.ads);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "YOUR_ADWHIRL_KEY_GOES_HERE");
adLayout.addView(adWhirlLayout);

The AdMob Adapter will call the destroy method when it is being destroyed. That method should be exist if you have the AdMob SDK included in your app. Make sure that you have the most recent version (4.3.1) of the Google AdMob SDK and that you have included it in your app.

Also, is this how you declared the AdActivity for AdMob in the manifest?

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

Finally, I don't know if it is related to this issue, but you defined some RelativeLayout params but you are adding it to a LinearLayout. You don't really need to specify those params at all. This should suffice:

LinearLayout adLayout = (LinearLayout) findViewById(R.id.ads);
AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "YOUR_ADWHIRL_KEY_GOES_HERE");
adLayout.addView(adWhirlLayout);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文