Googleplayservicescomponents: Xamarin.GooglePlayServices.Ads.Lite 71.1720.0-preview3: error during build

Created on 30 Apr 2019  路  24Comments  路  Source: xamarin/GooglePlayServicesComponents

Xamarin.Android Version (eg: 6.0):

Xamarin.Android 9.2.0.5

Operating System & Version (eg: Mac OSX 10.11):

Windows 10

Google Play Services Version (eg: 8.4.0):

Xamarin.GooglePlayServices.Ads.Lite 71.1720.0-preview3

Describe your Issue:

Error during project build

Include any relevant Exception Stack traces, build logs, adb logs:

error: MediationRewardedVideoAdListenerImplementor is not abstract and does not override abstract method zzb(Bundle) in MediationRewardedVideoAdListener
public class MediationRewardedVideoAdListenerImplementor ...\obj\Debug\90\android\src\mono\com\google\android\gms\ads\reward\mediation\MediationRewardedVideoAdListenerImplementor.java

Most helpful comment

After targeting Android 28 and updating Xamarin.GooglePlayServices.Ads.* to 71.1712.0, it's complaining because it's still looking for zzc instead of zzb:

..../Droid/obj/Debug/android/src/mono/com/google/android/gms/ads/reward/mediation/MediationRewardedVideoAdListenerImplementor.java(8,8): Error: error: MediationRewardedVideoAdListenerImplementor is not abstract and does not override abstract method zzc(Bundle) in MediationRewardedVideoAdListener
public class MediationRewardedVideoAdListenerImplementor

I am using Mac Visual Studio 8.1.5.

I've tried cleaning everything and removing all the build folders and stale packages I can find.
What am I missing? Thanks!

All 24 comments

This one's a bit weird and has given us troubles in the past. There's an obfuscated method on that public interface which we basically just have to expose.

In the past it looks like it was called zzc and we had metadata to mark it as not obfuscated so it would be bound: https://github.com/xamarin/GooglePlayServicesComponents/blob/1c46bed9fa7d1d269ce718d07b7d3f26f0a75478/source/com.google.android.gms/play-services-ads-lite/Transforms/Metadata.xml#L73

@moljac please investigate fixing this metadata, AND we should add a simple reference to this interface (make a dummy implementation of it maybe?) in the Tests project so that we catch this and it fails to compile in the Tests project for future versions.

From what I can tell, this seems to be fixed with preview4

@tipa Thanks a lot for your feedback. Closing this one.

After targeting Android 28 and updating Xamarin.GooglePlayServices.Ads.* to 71.1712.0, it's complaining because it's still looking for zzc instead of zzb:

..../Droid/obj/Debug/android/src/mono/com/google/android/gms/ads/reward/mediation/MediationRewardedVideoAdListenerImplementor.java(8,8): Error: error: MediationRewardedVideoAdListenerImplementor is not abstract and does not override abstract method zzc(Bundle) in MediationRewardedVideoAdListener
public class MediationRewardedVideoAdListenerImplementor

I am using Mac Visual Studio 8.1.5.

I've tried cleaning everything and removing all the build folders and stale packages I can find.
What am I missing? Thanks!

Looks like this error appears again with version 71.1712.0
@moljac

Just read the version numbers more carefully and realized the 71.1712.0 release package I had is older than the 71.1720.0-preview 4 with the fix. Latest as of this writing is 71.1720.0-preview 6.

The issue doesn't arise when i am using Xamarin.GooglePlayServices.Ads.Lite 71.1712.1.

When using xamarin.firebase.ads.lite/71.1601.0 the issue remains.

@Redth @moljac Are there plans to port this fix to xamarin.firebase.ads.lite?

No current plans to backport the fix, please use 71.1712.1. Is there any particular reason you cannot update?

@Redth No newer stable than 71.1601.0 is available for xamarin.firebase.ads.lite.

Ahh sorry misread that the issue exists in Firebase (I thought you were referring to two versions of the same package). We'll take a look at this.

@thisisthekap
This is the problem with transitive dependencies.

Notation:

  • . GPS - Google.Play.Services
  • . FB - Firebase

So, if you update GPS.Ads.Lite (or maybe even add it manually) the error should be resolved.

I will look into the issue to see if this could be done automatically.

@thisisthekap @erichedstrom @cFogger @tipa

Can you check latest 71.1720.1?

https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/71.1720.1
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads.Lite/71.1720.1

And close this issue...

I am not in the office this week. I am going to try the nuget next week, and let you know about my results.

Duplicates

250

241

240

236

Works for me now. Thank you @moljac for your effort and assistance!

I am running Xamarin.GooglePlayServices.Ads.Lite 71.1720.1 (just installed all new yesterday for a new app) and I am getting this error when the app starts up.

What do I do to fix it ? Or is this different issue?

Java.Lang.RuntimeException
Message=Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:


  • The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
  • should follow the instructions here: https://goo.gl/fQ2neu to add a valid *
  • App ID inside the AndroidManifest. Google Ad Manager publishers should *
  • follow instructions here: https://goo.gl/h17b6x. *

@karhukoti
Do you have any other dependency?

namely manual installation could break correct dependency chain.

Is there reference to Xamarin.GooglePlayServices.Ads?

Which version Xamarin.GooglePlayServices.Ads?

Can you provide minimal repro sample and few steps what has been done (added references etc)?

Thanks

@moljac I am not sure what you mean by "manual installation could break dependency" - I just installed the nuget xamarin packages, so I think I should say no to this question.

No, there is no reference to Xamarin.GooglePlayServices.Ads, I did now install this package and have the reference, but still same issue happens.

Both .Ads and .Ads.Lite are 71.1720.1

Well, basically, I added a new Xamarin project for Android 26 to 28.
Added the Ads stuff from the Xamarin ads lite article. Add some code to support maps.

Currently, I have in references:
Analyzers
Mono.Android
System
System.Core
System.Numerics.
System.Numerics.Vectors
System.XML
Xamarin.Android.Support.Core.Utils.
Xamarin.Android.Support.CustomTabs
Xamerin.Android.Support.Design
Xamarin.Essentials
Xamarin.GooglePlayService.Ads
Xamarin.GooglePlayServices.Ads.Lite
Xamarin.GooglePlayServices.Locat
Xamarin.GooglePlayServices.Maps

@karhukoti

We have issues with merging AndroidManifest.xml when multiple dependencies exist which modify Androidmanifest.xml (mostly Firebase, but also some other packages). We are testing new tools for manifest merging and I was suspecting that might be a problem here.

Manual installation

  • add Xamarin.Forms (you will get CustomTabs certain version)
  • what if there CustomTabs manually added before?
  • or if there is Xamarin.Auth having dependency on CustomTabs.

Those are cases where other dependency or manual addition of some package (CustomTabs in this case) might cause conflicts with version[s] of CustomTabs or even worse runtime errors if some of the packages uses CustomTabs with different version.

Sometimes I remove all packages and re-add them manually one by one...

@karhukoti

Ran into this issue recently after upgrading.
Only seemed to happen with ProGuard enabled.

Adding a ProGuardConfiguration to the build with the following got me working:

-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.**
-keep class android.support.v7.widget.**

Not sure this fits other scenarios on this linked thread as I don't see many comments related to ProGuard enabled or debug / release builds behaving differently. Not sure the dontwarn is still needed but it made AppCenter stop choochin.

Using:
Xamarin.Forms 4.3.0947036, Ads.Lite 71.1720.1

@iknowcodesoup

Thanks a lot for your feedback.

Slightly modified for Firebase:

# https://www.guardsquare.com/en/products/proguard/manual/usage

-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.**

-dontwarn com.google.firebase.**
-keep class com.google.firebase.**

-keep class android.support.v7.widget.**

# AndroidX (TODO: reduce surface)
-keep class androidx.**

Not sure this fits other scenarios on this linked thread as I don't see many comments related to ProGuard enabled or debug / release builds behaving differently.

You might be right. This is issue mostl likely related to multiple nugets with Android artifacts and improper AndroidManifes.xml merging.

@karhukoti

I see you use multiple Google.Play.Services and Firebase packages... Can you try adding Xamarin.Android.ManifestMerger to the project, please?

And report if that fixes the issue.

71.1720.1 works for me.

@karhukoti Did you read the goo.gl links in the error message you posted? Newer Google Ads Libraries now require an entry in AndroidManifest.xml for AdMob or Ad Manager. I ran into that too.

The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
should follow the instructions here: https://goo.gl/fQ2neu to add a valid *
App ID inside the AndroidManifest. Google Ad Manager publishers should *
follow instructions here: https://goo.gl/h17b6x. *

closing this one

Was this page helpful?
0 / 5 - 0 ratings