Xamarin.GooglePlayServices.Ads Library Unusable Since 2021 - Callbacks Not Properly Adapted
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- android, csharp
- Área
- mobile-dev
Línea de trabajo
Comienza reproduciendo el problema de los callbacks con Xamarin.GooglePlayServices.Ads e inspecciona las clases de callback afectadas enumeradas en la issue, incluidas InterstitialAdLoadCallback y RewardedAdLoadCallback. Compara las firmas de callback expuestas con los tipos de Android descritos en el informe. Se considera terminado cuando los callbacks afectados exponen overrides tipados utilizables y los problemas de compilación y colisión de JNI informados ya no se producen.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Android framework version
net9.0-android
Affected platform version
Description
I find it surprising that there is no unified issue addressing this, despite numerous reports scattered across the internet and users creating their own plugins to workaround this problem.
This issue has been present since 2021, making the Xamarin.GooglePlayServices.Ads library completely unusable. I am currently testing with the latest version 123.6.0.1, released on January 22, 2025.
Despite new versions being released, the issue has persisted for four years. There are multiple workarounds available, such as the one proposed here:
https://gist.github.com/dtaylorus/63fef408cec34999a1e566bd5fac27e5
However, in all related issues that get opened, people spam their own NuGet packages (mostly paid) that merely implement the same workaround.
But... how is it possible that no official issue exists here, and no serious fix is being considered?
Am I the only one using MAUI and AdMob? I am not deeply familiar with the inner workings of these libraries or how official they are in MAUI, but it is unfortunate that they remain broken, given MAUI's potential.
The Problem:
AdMob callbacks are implemented in classes where methods are overridden. However, many of these callbacks are not properly adapted in the C# bindings.
Example:
For implementing an Interstitial Ad (Android.Gms.Ads.Interstitial.InterstitialAd), an instance of the Android.Gms.Ads.Interstitial.InterstitialAdLoadCallback class must be passed to handle the callbacks.
Before the library broke five years ago, the correct implementation was:
public class InterstitialCallbackImplementation : Android.Gms.Ads.Interstitial.InterstitialAdLoadCallback {
public override void OnInterstitialAdLoaded(InterstitialAd interstitialAd) {
base.OnInterstitialAdLoaded(interstitialAd);
// Ok
}
public override void OnAdFailedToLoad(LoadAdError e) {
base.OnAdFailedToLoad(e);
// Fail
}
}
However, now the method OnInterstitialAdLoaded(InterstitialAd interstitialAd) does not exist for override.
Instead, there is another method:
public override void OnAdLoaded(Java.Lang.Object p0)
The binding does not correctly identify p0 as its corresponding type, InterstitialAd.
At first glance, this might seem like a minor issue—one could cast p0 as Android.Gms.Ads.Interstitial.InterstitialAd.
However, this does not work. Trying to do so results in compilation failures, JNI collisions, and a host of other issues.
With all the effort behind these libraries, it's baffling that a few improperly adapted parameters have rendered them completely unusable for five years.
Affected Classes:
com/google/android/gms/ads/admanager/AdManagerInterstitialAdLoadCallback
com/google/android/gms/ads/appopen/AppOpenAd$AppOpenAdLoadCallback
com/google/android/gms/ads/interstitial/InterstitialAdLoadCallback
com/google/android/gms/ads/rewarded/RewardedAdLoadCallback
com/google/android/gms/ads/rewardedinterstitial/RewardedInterstitialAdLoadCallback
Android.Gms.Ads.NativeAd.NativeAd.IOnNativeAdLoadedListener
Questions:
What is the current status of these libraries?
How is it possible that such a critical issue remains unresolved for so long?
Thank you.
Steps to Reproduce
Install Xamarin.GooglePlayServices.Ads and try to use it.
Did you find any workaround?
https://gist.github.com/dtaylorus/63fef408cec34999a1e566bd5fac27e5
Relevant log output
- Lenguaje dominante
- C#
- Estrellas
- 318
- Forks
- 73
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 8
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/android-libraries
-
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
dotnet/android-libraries#1549 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
dotnet/android-libraries#1503 ·
-
Compose UI.Graphics: SolidColor(long) constructor stripped due to Kotlin @JvmInline value class param (sibling of java-interop#1440 for ctors)Quizá libre de nuevo @jonathanpeppers la tomó hace 115 días y no hay ningún pull request abierto. Abierto
dotnet/android-libraries#1470 · 1 reacción · 2 asignados ·
-
Kotlin `object` companion field not surfaced on outer class binding (KeyboardOptions.Companion, TextStyle.Companion, ...)Posiblemente ocupada @jonathanpeppers la tomó hace 116 días. Abierto
dotnet/android-libraries#1467 · 1 reacción · 2 asignados ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
dotnet/android-libraries#1456 · 2 comentarios · 1 reacción ·
Todos los issues de dotnet/android-libraries
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
area:frontend bug FE mvp P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
klasolsson81/jobbliggaren#1989 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: Missing extensions in Agent Card capabilities in v0.3 compat modePosiblemente ocupada @hwanders la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
a2aproject/a2a-dotnet#514 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
agentic-workflows untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Webview: rotary icons to TablerAbiertoVS Code
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
AlamoEngine-Tools/pg-starwarsgame-lsp#207 ·
Los mantenedores suelen responder en 1 día