I do not declare FOREGROUND_SERVICE_DATA_SYNC
anywhere in my android manifest but it seems to appear in the final build.
Now I can't publish to play console because I must explain why I need the permission, because I'm targeting SDK 34.
How do I remove this permission
Look at the merged manifest -- there is a sub-tab for this in Android Studio's manifest editor. Some library that you are using is contributing that android:foregroundServiceType
attribute. Once you identify the library, you can either:
tools:remove="android:foregroundServiceType"
in your own manifest to remove this attribute, at the risk of your app not working properly