Where is "actual" AndroidManifest used build app bundle?

Google keeps refusing my app bundle because my app contains Ads but doesn’t have “permission.AD_ID” permission:

your advertising id declaration in play console says that your app uses advertising id. a manifest file in one of your active artifacts doesn’t include the com.google.android.gms.permission.ad_id permission.

But this is totally wrong. In my custom AndroidManifest, there is gms.permission.AD_ID.

<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
</manifest>

My game is in internal testing; only 1 build was uploaded, which doesn’t have that(it was a pure test of the actual game works, no Ads). Removing the previous build is impossible. There’s only one build that exists, and replacing it is also impossible because Google refuses.

Adding tools:node=“remove”? No, not working. Force refresh with clear the cache? No, that’s not working. Does my AndroidManifest.xml apply properly? As far as I remember, after the build, there’s an AndroidManifest file that still remains in the Temp/Staging folder, but there’s nothing in there. WTF. Then how do I make sure “” was inserted? Is it even inserted? Why is everything in Unity getting worse and worse? Sick and tired of this every time it happens; it’s just total waste of my time.

Can you Export to a gradle project from Unity and see if the <uses-permission is being added to the right manifest?

Are you using UnityAds?

Try opening the bundle in Android Studio, manifest should be in main apk.

1 Like

I just exported and opened it with Android Studio, and there are two AndroidManifest:

  • launcher/src/main
  • unityLibrary/src/main

which one is correct one

I wasn’t added yet, but I checked the game contains ads in Google Play Console because I planned to add it later(this game is in internal testing). Google Console complains about permission, so I just installed the Advertisement package, but it’s not a big issue in this case.

You can open the launcher/manifests/AndroidManifest.xml and click the Merged Manifest (docs) tab at the bottom of the editor. It will give you the resulting final AndroidManifest after all the manifests from unityLibrary and other libraries (such as Ads) are merged. You should see the <uses-permission tag in the right place there.

Another option to see the final AndroidManifest.xml is to use the apkAnalyzer from Android Studio, you can inspect from there the files inside the bundle/apk and see what’s the resulting AndroidManifest.xml after merge. → Read more about it in the official Android documentation

In context of app - neither. All manifests are combined into one. Build apk and open it in Android Studio to see it. To be 100% sure - build app bundle and open that.

I just opened abb with APK Anaylzer and saw the manifest, and there is “” exists. Then it’s not Unity’s problem?

I suspect it could be because your only active artifacts in testing track DOES NOT have the Ads manifest entry.

Try to turn off the app declaration for ads ‘does not use ads’ then upload a new artifact with the ads declaration.
You should then be able to turn off /deactivate the initial APK in the testing track. And then turn on the ‘uses ads’ toggle again and upload a correct artifact.

1 Like