MTAdmob icon indicating copy to clipboard operation
MTAdmob copied to clipboard

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

Open Kareldrie opened this issue 1 year ago • 5 comments

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!

Kareldrie avatar Aug 07 '22 21:08 Kareldrie

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

Hrishikesh46779 avatar Aug 18 '22 16:08 Hrishikesh46779

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

freezersharp avatar Aug 27 '22 12:08 freezersharp

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.

marcojak avatar Aug 27 '22 20:08 marcojak

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

PonyOny avatar Sep 01 '22 20:09 PonyOny

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

freezersharp avatar Sep 02 '22 02:09 freezersharp