How to fix the issue Google Tag Manager integration with Xamarin Android App

N2517 1 Reputation point
2021-09-16T14:18:49.907+00:00

I am developing Mobile app using Xamarin Android. I have integrated Firebase with our app successfully. I am using GTM android version 5. https://developers.google.com/tag-manager/android/v5

Google Tag Manager container with test tag (GTM-xxxxxxx.json) is placed in Assets/Containers folder as specified, however while all event records ARE showing up in Firebase Analytics console, they do not seem to be sent to GTM. Logs seem to indicate an issue with loading GTM:

Failed to invoke Tag Manager's initialize() method: java.lang.reflect.InvocationTargetException: com.google.android.gms.measurement.internal.zzda.zza(Unknown Source:97)

and error when run container preview:

Java.Lang.NoSuchMethodError: 'No virtual method transactAndReadExceptionReturnVoid(ILandroid/os/Parcel;)V in class Lcom/google/android/gms/internal/measurement/zzq; or its super classes (declaration of 'com.google.android.gms.internal.measurement.zzq' appears in /data/app/com.xxpackage.xxname-OT45U1GpA6ulFZw56hg9XQ==/base.apk)'
Using following Nuget Packages:

"Xamarin.Firebase.Analytics" 71.1630.4
"Xamarin.Firebase.Analytics.Impl" 71.1630.4
"Xamarin.Firebase.Messaging" 121.0.1
"Xamarin.GooglePlayServices.TagManager" 71.1604.4
android minSdkVersion="24" and targetSdkVersion="30"

Any insight into this issue would be super helpful, as my search hasn't turned up anything useful that is Xamarin-related so far.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,326 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,951 Reputation points
    2021-09-17T06:26:23.767+00:00

    Hello N2517-2864,​

    Welcome to our Microsoft Q&A platform!

    This may be related to the version compatibility with 'Xamarin.GooglePlayServices.TagManager' package. Someone faced the similar issue, the workaround is to download the package to 60 version. Here is the topic, you could refer to it. https://github.com/xamarin/GooglePlayServicesComponents/issues/260

    If the problem described by the link is different from the one you are experiencing, it's suggested to open a new thread to report the issue to the github repo.

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments