marcojak / MTAdmob

Admob plugin for Xamarin Android and iOS
https://www.xamarinexpert.it/admob-made-easy/
160 stars 26 forks source link

The name 'MobileAds' does not exist in the current context #109

Closed Kareldrie closed 1 year ago

Kareldrie commented 2 years ago

Hi,

After the update (1.8.0) I get in MainActivity.cs "The name 'MobileAds' does not exist in the current context". Has anything changed?

Thank you very much. Keep up the great work!

Hrishikesh46779 commented 2 years ago

I am also facing this same issue in update (1.8.0)

freezersharp commented 2 years ago

The same issue. Why doesn't test it before than publish the update???

marcojak commented 2 years ago

Hi,

MobileAds is not part of this plugin but it's part of the package Xamarin.GooglePlayServices.Ads.Lite.

Make sure to have this in your MainActivity.cs:

using Android.Gms.Ads;

id this is not recognised, add the nuget package Xamarin.GooglePlayServices.Ads.Lite to your Android project.

PonyOny commented 2 years ago

You have to change your Android target version to at least 12 in order to be compatible with version (1.8.0) image

freezersharp commented 2 years ago

Hi,

MobileAds is not part of this plugin but it's part of the package Xamarin.GooglePlayServices.Ads.Lite.

Make sure to have this in your MainActivity.cs:

using Android.Gms.Ads;

id this is not recognised, add the nuget package Xamarin.GooglePlayServices.Ads.Lite to your Android project.

I cannot add it:

Error NU1107 Version conflict detected for Xamarin.AndroidX.Lifecycle.LiveData. Install/reference Xamarin.AndroidX.Lifecycle.LiveData 2.4.1.1 directly to project IDDAM_SV.Android to resolve this issue. IDDAM_SV.Android -> Xamarin.GooglePlayServices.Ads.Lite 121.0.0.1 -> Xamarin.AndroidX.Work.Runtime 2.7.1.3 -> Xamarin.AndroidX.Lifecycle.LiveData (>= 2.4.1.1) IDDAM_SV.Android -> Xamarin.Forms 5.0.0.2515 -> Xamarin.AndroidX.Lifecycle.LiveData (>= 2.3.1.1 && < 2.4.0). IDDAM_SV.Android D:\Proyectos\Versionado\IDDAM SV\IDDAM_SV.Android\IDDAM_SV.Android.csproj