在 Android、Google Play 服务不存在的情况下在 Xamarin Studio 上使用 AdMob
Use AdMob on Xamarin Studio with Android, Google Play Services don't exist
我最近尝试在我的 Xamarin Android 应用程序上使用 Google AdMob。但是,我一直未能成功。首先,我无法按照教程进行操作(例如,这个:https://blog.tommyparnell.com/admob-with-xamarin-part-1-banner-ads/),这里是说转到 "get more components"(我正在使用 Xamarin Studio)并下载 Google 播放服务 (Jellybean)。但是,我找不到它,而是找到了很多 Google Play Services 组件。我尝试安装一个名为:"Google Play Services - Ads"(我想这个是与 Admobs 相关的那个)。但是,似乎有些东西不工作了,该组件似乎已停用,并显示以下内容:
Some required packages are not referenced by the project
我很绝望,真的不知道该怎么办。我能做什么?
另请注意,我拥有最新版本的 SDK。这可能是问题所在吗?如果是这样,我该如何解决这个问题?
提前致谢
您提到的教程 已过时 并且使用的是 "Xamarin Google Play Services - All" 软件包的弃用版本。
您需要单独的 "Ads" 包来提供 ADMob
命名空间 (using ADMob;
),同时安装相关的 Play 服务依赖项,您必须根据教程相应地更新代码以匹配新广告 namespace/api。展示广告的整体代码和流程是有效的。
打开包管理器并搜索 "Xamarin Google Play Services Ads"
>Install-Package Xamarin.GooglePlayServices.Ads -Version 27.0.0
Nuget 页面:
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/27.0.0
最新测试版:
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/28.0.0-beta1
The 'Xamarin Google Play Services - All' nuget package is now
deprecated.
You should instead use the individual NuGet packages to get only the
bindings you need in your application.
You can find the individual packages by searching for 'xamarin google
play services':
https://www.nuget.org/packages?q=xamarin+google+play+services
我最近尝试在我的 Xamarin Android 应用程序上使用 Google AdMob。但是,我一直未能成功。首先,我无法按照教程进行操作(例如,这个:https://blog.tommyparnell.com/admob-with-xamarin-part-1-banner-ads/),这里是说转到 "get more components"(我正在使用 Xamarin Studio)并下载 Google 播放服务 (Jellybean)。但是,我找不到它,而是找到了很多 Google Play Services 组件。我尝试安装一个名为:"Google Play Services - Ads"(我想这个是与 Admobs 相关的那个)。但是,似乎有些东西不工作了,该组件似乎已停用,并显示以下内容:
Some required packages are not referenced by the project
我很绝望,真的不知道该怎么办。我能做什么? 另请注意,我拥有最新版本的 SDK。这可能是问题所在吗?如果是这样,我该如何解决这个问题?
提前致谢
您提到的教程 已过时 并且使用的是 "Xamarin Google Play Services - All" 软件包的弃用版本。
您需要单独的 "Ads" 包来提供 ADMob
命名空间 (using ADMob;
),同时安装相关的 Play 服务依赖项,您必须根据教程相应地更新代码以匹配新广告 namespace/api。展示广告的整体代码和流程是有效的。
打开包管理器并搜索 "Xamarin Google Play Services Ads"
>Install-Package Xamarin.GooglePlayServices.Ads -Version 27.0.0
Nuget 页面:
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/27.0.0
最新测试版:
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/28.0.0-beta1
The 'Xamarin Google Play Services - All' nuget package is now deprecated.
You should instead use the individual NuGet packages to get only the bindings you need in your application.
You can find the individual packages by searching for 'xamarin google play services': https://www.nuget.org/packages?q=xamarin+google+play+services