Fixing `Google Api Error: Invalid request - Your app targets Android 13 (API 33) or above. You must declare the use of advertising ID in Play Console.`

After struggling for hours to make my Flutter app compile in Android again, I am facing the last few hurdles before being able to publish a long awaited update.

Google Api Error: Invalid request - Your app targets Android 13 (API 33) or above. You must declare the use of advertising ID in Play Console.

Once signed into the Console, I see this ominous warning:

Clicking the link brings me to this:

That's indeed what I am trying to fix.

But no matter where I looked, I could not find where to declare that I am not using any advertising ID. I had to look it up in a forum to find the answer. Talk about bad UI.

So I try to publish the app again and I get:

[!] Google Api Error: Invalid request - This release includes the com.google.android.gms.permission.AD_ID permission but your declaration on Play Console says your app doesn't use advertising ID. You must update your advertising ID declaration.

Using this post: https://stackoverflow.com/questions/73129574/you-cant-submit-updates-as-some-information-about-your-app-is-incomplete-googl, I learned that I can find what is causing this issue:

You can find your final permission in the merged manifest file at app/build/intermediates/manifests/full/debug/AndroidManifest.xml
27-->[:firebase_analytics] /Users/anhtuan/git/flashcards/build/firebase_analytics/intermediates/merged_manifest/release/AndroidManifest.xml:11:22-65
28    <uses-permission android:name="com.google.android.gms.permission.AD_ID" />

Alright so it is indeed because of analytics.

After declaring that I do indeed use an AD_ID for Analytics, the Store accepts my update. It's always painful to publish an app after months of inactivity.