dotnet / android-libraries

.NET for Android bindings for Google's libraries, such as AndroidX, GooglePlayServices, Firebase, and MLKit and their 3rd party dependency libraries.
MIT License
233 stars 50 forks source link

NativeCustomFormatAd and related types missing from Ads/Ads.Lite #973

Open jump32 opened 1 year ago

jump32 commented 1 year ago

Google Play Services Version

Describe your Issue

Between version 121.2.0 and version 121.3.0 there are a number of interfaces and classes that have gone missing. As far as I can tell they still exist in the original Google SDKs.

The missing definitions are:

Relevant information

You can compare https://www.fuget.org/packages/Xamarin.GooglePlayServices.Ads.Lite/121.2.0/lib/net6.0-android31.0/Xamarin.GooglePlayServices.Ads.Lite.dll/Android.Gms.Ads.NativeAd

and https://www.fuget.org/packages/Xamarin.GooglePlayServices.Ads.Lite/121.3.0/lib/net6.0-android31.0/Xamarin.GooglePlayServices.Ads.Lite.dll/Android.Gms.Ads.NativeAd

Under the Android.Gms.Ads.NativeAd namespace you can see the missing interfaces.

Steps to Reproduce (with link to sample solution if possible):

Download and build https://github.com/jump32/ads-test (should build ok) Update Xamarin.GooglePlayServices.Ads.Lite to 121.3.0 or greater Rebuild (should fail with unknown type)

mhdwaelanjo commented 1 year ago

I fixed the problem.. we can use my libraries :

 <PackageReference Include="Anjo.Android.GoogleServices.Ads" Version="22.0.0" />
 <PackageReference Include="Anjo.Android.GoogleServices.AdsBase" Version="22.0.0" />
 <PackageReference Include="Anjo.Android.GoogleServices.AdsLite" Version="22.0.0" />

Supports fixing the problem of Loading ads using :

jump32 commented 1 year ago

I'd prefer the original packages to be fixed.

moljac commented 1 year ago

Investigating namespace Android.Gms.Ads.NativeAd (package package)

Version 21.2.0:

jar tvf ./play-services-ads-lite-21.2.0.aar/classes.jar | grep "com/google/android/gms/ads/nativead/"

results:

 1259 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/AdChoicesView.class
  2571 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/MediaView.class
   797 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$AdChoicesInfo.class
   646 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$Image.class
   469 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$OnNativeAdLoadedListener.class
   495 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$UnconfirmedClickListener.class
  2659 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAd.class
   963 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdAssetNames.class
   347 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$AdChoicesPlacement.class
  2825 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$Builder.class
   355 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$NativeMediaAspectRatio.class
  2295 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions.class
 10410 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdView.class
  4102 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeAdViewHolder.class
   475 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$DisplayOpenMeasurement.class
   520 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomClickListener.class
   523 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomFormatAdLoadedListener.class
  1763 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd.class
   369 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/zzb.class
   369 Tue Aug 30 09:29:28 CEST 2022 com/google/android/gms/ads/nativead/zzc.class

Version 21.3.0:

jar tvf ./play-services-ads-lite-21.3.0.aar/classes.jar | grep "com/google/android/gms/ads/nativead/"

results:

  1259 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/AdChoicesView.class
  3390 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/MediaView.class
   797 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$AdChoicesInfo.class
   646 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$Image.class
   469 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$OnNativeAdLoadedListener.class
   495 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd$UnconfirmedClickListener.class
  2659 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAd.class
   963 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdAssetNames.class
   347 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$AdChoicesPlacement.class
  2825 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$Builder.class
   355 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions$NativeMediaAspectRatio.class
  2295 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdOptions.class
 10410 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdView.class
  4102 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeAdViewHolder.class
   475 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$DisplayOpenMeasurement.class
   520 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomClickListener.class
   523 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomFormatAdLoadedListener.class
  1949 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/NativeCustomFormatAd.class
   369 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/zzb.class
   369 Wed Sep 14 12:43:36 CEST 2022 com/google/android/gms/ads/nativead/zzc.class

Version currently bound:

 jar tvf ./externals/com.google.android.gms/play-services-ads-lite/classes.jar | grep "com/google/android/gms/ads/nativead/"
  1259 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/AdChoicesView.class
  3537 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/MediaView.class
   797 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd$AdChoicesInfo.class
   646 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd$Image.class
   469 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd$OnNativeAdLoadedListener.class
   495 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd$UnconfirmedClickListener.class
  2779 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAd.class
   963 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdAssetNames.class
   347 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions$AdChoicesPlacement.class
  3377 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions$Builder.class
   355 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions$NativeMediaAspectRatio.class
   353 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions$SwipeGestureDirection.class
  2744 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdOptions.class
 10369 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdView.class
  4093 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeAdViewHolder.class
   475 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeCustomFormatAd$DisplayOpenMeasurement.class
   520 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomClickListener.class
   523 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeCustomFormatAd$OnCustomFormatAdLoadedListener.class
  1665 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/NativeCustomFormatAd.class
   369 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/zzb.class
   369 Tue Jul 18 14:48:48 CEST 2023 com/google/android/gms/ads/nativead/zzc.class

MCWs:

ll generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.*

results:

-rw-r--r--  1 user  wheel   7680 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.AdChoicesView.cs
-rw-r--r--  1 user  wheel   9573 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.MediaView.cs
-rw-r--r--  1 user  wheel  87761 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAd.cs
-rw-r--r--  1 user  wheel   5058 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAdAssetNames.cs
-rw-r--r--  1 user  wheel  42261 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAdOptions.cs
-rw-r--r--  1 user  wheel  30723 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAdView.cs
-rw-r--r--  1 user  wheel   6986 Aug 27 18:59 generated/com.google.android.gms.play-services-ads-lite/obj/Debug/monoandroid12.0/generated/src/Android.Gms.Ads.NativeAd.NativeAdViewHolder.cs
moljac commented 1 year ago

@jump32 Thanks for the feedback.

Can you please elaborate this:

As far as I can tell they still exist in the original Google SDKs.

The missing definitions are:

  • INativecustomFormatAdExtensions
  • NativeCustomFormatAd
  • NativeCustomFormatAdConstants
  • INativeCustomFormatAd
  • (others relating to NativeCustomFormatAd)

INativeCustomFormatAd is missing and I am investigating why, but I other types you mentioned are not available in both 21.2.0 and 21.3.0..

  • (others relating to NativeCustomFormatAd)

Which other related types would that be?

jpobst commented 1 year ago

Mel's research from Discord:

obj/Debug/monoandroid12.0/api.xml(4354,6): warning BG8503: Invalidating
'Android.Gms.Ads.NativeAd.INativeCustomFormatAd' and all its nested types because some of its methods were invalid.
[./generated/com.google.android.gms.play-services-ads-lite/com.google.android.gms.play-services-ads-lite.csproj]

leads to

obj/Debug/monoandroid12.0/api.xml(4362,8): warning BG8701: Invalid return type 'com.google.android.gms.ads.MediaContent'
 for member 'Android.Gms.Ads.NativeAd.INativeCustomFormatAd.GetMediaContent ()'.
[./generated/com.google.android.gms.play-services-ads-lite/com.google.android.gms.play-services-ads-lite.csproj]

further MediaContent points to:

obj/Debug/monoandroid12.0/api.xml(685,6): warning BG8503: Invalidating 'Android.Gms.Ads.IMediaContent' and all its nested 
types because some of its methods were invalid. [./generated/com.google.android.gms.play-services-ads-
lite/com.google.android.gms.play-services-ads-lite.csproj]

and that leads to:

obj/Debug/monoandroid12.0/api.xml(695,8): warning BG8700: Unknown return type 
'com.google.android.gms.internal.ads.zzbff' for member 'Android.Gms.Ads.IMediaContent.Zza ()'. 
[./generated/com.google.android.gms.play-services-ads-lite/com.google.android.gms.play-services-ads-lite.csproj]

So, 2 interfaces were transitively removed because some obfuscated type has invalid return type.

jump32 commented 1 year ago

Hi @moljac

Having initially identified the issue, I was just comparing the fuget links I posted. So as far as I can see from those two links, the missing types are:

NativeCustomFormatAdOnCustomClickEventArgs NativeCustomFormatAdOnCustomFormatAdLoadedEventArgs INativeCustomFormatAdExtensions NativeCustomFormatAd NativeCustomFormatAdConsts INativeCustomFormatAd INativeCustomFormatAdDisplayOpenMeasurement INativeCustomFormatAdOnCustomClickListener INativeCustomFormatAdOnCustomFormatAdLoadedListener

Since they are all related to NativeCustomFormatAd, if you manage to restore that class I suspect the other will be restored as well.

jump32 commented 1 year ago

Hi @moljac Is there any progress on this?

moljac commented 1 year ago

No.Not yet.

Picao84 commented 8 months ago

It's been a few months now. Any fix soon?

Picao84 commented 8 months ago

I fixed the problem.. we can use my libraries :

 <PackageReference Include="Anjo.Android.GoogleServices.Ads" Version="22.0.0" />
 <PackageReference Include="Anjo.Android.GoogleServices.AdsBase" Version="22.0.0" />
 <PackageReference Include="Anjo.Android.GoogleServices.AdsLite" Version="22.0.0" />

Supports fixing the problem of Loading ads using :

  • Let's rename for Interstitial ads InterstitialAdLoadCallback to AnjoInterstitialLoadCallback.
  • Let's rename for Rewarded ads RewardedAdLoadCallback to AnjoRewardedLoadCallback.
  • Let's rename for App Open Ads AppOpenAd.AppOpenAdLoadCallback to AnjoAppOpenLoadCallback.
  • Let's rename for Rewarded interstitial ads RewardedInterstitialAdLoadCallback to AnjoRewardedInterstitialLoadCallback.

But you did not fix the problem? All the issues on this ticket are present on your nuget package, as there is no NativeCustomFormatAd, no MediaContent, etc...