Xamarin.GooglePlayServices.Ads Library Unusable Since 2021 - Callbacks Not Properly Adapted
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- android, csharp
- Lĩnh vực
- mobile-dev
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện sự cố callback với Xamarin.GooglePlayServices.Ads và kiểm tra các lớp callback bị ảnh hưởng được liệt kê trong issue, bao gồm InterstitialAdLoadCallback và RewardedAdLoadCallback. So sánh các chữ ký callback được cung cấp với các kiểu Android được mô tả trong báo cáo. Được xem là hoàn tất khi các callback bị ảnh hưởng cung cấp các override có kiểu có thể sử dụng và các vấn đề biên dịch cũng như xung đột JNI được báo cáo không còn xảy ra.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- C#
- Star
- 319
- Fork
- 73
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/android-libraries
-
Stable Updates 20261019Có thể đã có người làm @jonathanpeppers đã nhận 1 ngày trước. Đang mở
dotnet/android-libraries#1565 · 1 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Unfreeze Xamarin.Firebase.Firestore and Xamarin.Protobuf.JavaLite now that Firebase BoM 35.0.0 fixes the Protolite conflictCó thể đã có người làm @jonathanpeppers đã nhận 7 ngày trước. Đang mở
dotnet/android-libraries#1563 · 1 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 20/100
dotnet/android-libraries#1561 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Regression: incorrect nullability annotations in Xamarin.AndroidX.AppCompat 1.8.0Có thể đã có người làm @jonathanpeppers đã nhận 10 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 40/100
dotnet/android-libraries#1558 · 1 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
dotnet/android-libraries#1549 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của dotnet/android-libraries
Issue tương tự
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
elsa-workflows/elsa-foundation#3130 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
遥测历史查询始终返回 HTTP 400,页面静默无结果Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Format request: .wbpzĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
KnifeLemon/Filee#294 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
GlebKievsky/git-tips#4 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 77/100
OrchardCMS/OrchardCore#20088 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày