'Xamarin.Android: We found ad SDKs in your app

I have a Xamarin Android app that Google thinks uses ad SDKs. The app does not use advertising.

enter image description here

I've had this issue pop up when I used to work on native Android apps -- Firebase turned out to be the culprit and was able to workaround this by modifying my Gradle dependencies to specifically exclude the packages as mentioned in this answer:

implementation('com.google.firebase:firebase-core:19.0.2') {
    exclude module: "play-services-ads-identifier"
    exclude module: "play-services-measurement"
    exclude module: "play-services-measurement-sdk"
} 

My Xamarin project also uses Firebase analytics and I suspect the same issue to be the root cause but I'm not sure how to exclude any transitive dependencies like I've done using Gradle

The relevant Nuget packages the project uses:

  1. Xamarin.Firebase.Analytics
  2. Xamarin.Firebase.Analytics.Impl
  3. Xamarin.Firebase.Common
  4. Xamarin.Firebase.Iid
  5. Xamarin.Firebase.Messaging

EDIT: Upon a closer look, it looks like Xamarin.Firebase.Analytics.Impl is pulling in Xamarin.GooglePlayServices.Ads.Identifier which might be the issue. Every Firebase integration guide I've ever read on the web mentions adding this dependency.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source