Why APK files has some android permissions when they are not defined in any android manifest files?

I have a Unity project. I haven’t defined any special android permission in the project. But when I make a build, the APK file has access to PHONE and STORAGE. I exported the project and opened it in android studio. But in there also, there is not any permission defined in any manifest files of the project. I know these permissions are automatically added by Unity when we use specific codes in our project, but those permissions must be in the manifest files when we get an export.

Has anyone had this problem before? I am using Unity 2020.3.15f2.

Correct, if the permission would be added by Unity, that permission would be in the manifest when you export the project. Since that doesn’t happen in your case - those permissions are not added by Unity. You probably have plugins in your project which have those permissions specified in their manifest files.

I Checked all the manifest files. These permission are not defined in any of them. I also searched for ‘<manifest’ to find all the manifest files. PHONE and STORAGE permission are not defined anywhere. 7475597--919057--Screenshot 2021-09-06 211949.png

Is targetSdkVersion specified in your build.gradle files? If it’s missing, then this is the cause. Take a look at “Note” sections in Manifest.permission  |  Android Developers and Manifest.permission  |  Android Developers documentation pages.

I have 5 build.gradle files. In 4 of them targetSdkVersion is specified. Also, I tried to add it to the first build.gradle file, but I got an error message.

Well, plugins and missing targetSdkVersion were the only obvious things that came to my mind. You can try to create a new project and then step by step add similar configurations to what you have in your current project. This way you should be able to figure out which setting causes the permissions to get added. Since from your description it seems that Unity does not add them, there is no need to add scenes and scripts. Start by doing similar modifications to custom gradle and manifest templates, add the same plugins.

I found the solution. In one of the aar files of the Google Admob plugin, targetSdkVersion was missing.
https://github.com/googleads/googleads-mobile-unity/issues/1620

Solution: Update admob plugin

Thank you @JuliusM