1

我有一个使用 MobFox 和 AdMob 的应用程序。如果 MobFox 广告未展示,则会显示 AdMob 广告。我最近将 android sdk 升级到 20,除了许多错误和减慢的 eclipse 之外,mobfox 向我展示了很多错误。我升级了 mobfox sdk 并更改了代码以显示 mobfox 广告。然后我想让 admob 广告工作,但我不断收到错误。我将其更新为最新的 sdk,6.1.0。 问题是,MobFox 和 AdMob 都使用 AdView。

如果我添加import com.adsdk.sdk.banner.AdView;MobFox 广告有效,但 AdMob 代码中出现错误。如果我添加import com.google.ads.AdView;Admob 广告,但 MobFox 代码中出现错误:

The import com.google.ads.AdView collides with another import statement

仅导入相关 MobFox AdView 时出现 AdMob 错误示例:

The method loadAd(AdRequest) is undefined for the type AdView

  AdView ad = (AdView)findViewById(R.id.admobContent);
  ad.loadAd(new AdRequest()); //error

我导入 com.google.ads.*;徒劳,因为它不识别 admob AdView:

The constructor AdView(MainActivity, AdSize, String) is undefined

由于这个导入错误,我无法在我的应用中同时实现这两个广告网络。有任何想法吗?

4

1 回答 1

0

Are you using AdMob Mediation? If so, you just pop in the MobFox SDK and adapter, and you don't have to write any of the code yourself.

If you aren't using a mediation solution (I would recommend one btw), you can avoid this issue by removing on the of the imports, and referencing the class by it's fully qualified class. For example:

com.google.ads.AdView ad = (com.google.ads.AdView)findViewById(R.id.admobContent);

Then you won't need to import com.google.ads.AdView.

于 2012-09-24T23:10:57.330 回答