[英]Xamarin.Forms add Google AdMob integration
我過去成功實現了谷歌AdMob,但是這次有了新項目,這是不可能的!
我在空白 Xamarin.Forms 項目中集成 Google AdMob 時出錯。
在標准項目中:
是否已經安裝了 Nuget 軟件包:
Create AdmobControl class In the MainPage.xaml.cs add the AdmobControl with the banner ad id for Android TEST: "ca-app-pub-3940256099942544/6300978111"
在 Android 項目中:
是否已經安裝了 Nuget 軟件包:
然后安裝Nuget package Xamarin.Z035489FF8D0927460943E4A831Z1.
在 MainActivity 中,在 Xamarin.Forms.Init 之前初始化 Ads,App id 為 Android TEST: "" -> 空字符串
添加 ACCESS_NETWORK_STATE 權限
添加 INTERNET 權限
在AndroidManifest.xml標簽之間添加一行
創建 AdMobRenderer class
問題:
The compilation is ok BUT, when I deploy on app on my device, I have 2 errors: error: MediationRewardedVideoAdListenerImplementor is not abstract and does not override abstract method zzc(Bundle) in MediationRewardedVideoAdListener public class MediationRewardedVideoAdListenerImplementor TestAdMob.Android C:\Users\TheFloods \source\repos\TestAdMob\TestAdMob\TestAdMob.Android\obj\Debug\90\android\src\mono\com\google\android\gms\ads\reward\mediation\MediationRewardedVideoAdListenerImplementor.java 4
JAVAC0000:錯誤:MediationRewardedVideoAdListenerImplementor 不是抽象的,並且不會覆蓋 MediationRewardedVideoAdListener public class MediationRewardedVideoAdListenerImplementor 0 中的抽象方法 zzc(Bundle)
此處提供源代碼: https://github.com/TheFloods/XamarinTestAdMob
我嘗試按照那里的教程進行操作:
其他資料:
謝謝您的幫助。
謝謝兩位的幫助。 我已經解決了這樣的問題:
A question, why we need to install manually the package Xamarin.GooglePlayServices.Ads.Lite if it's already in dependencies of the Xamarin.Firebase.Ads.Lite?
問候
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.