编译安卓直装版的apk时,unity某些版本或某些xr interaction toolkit版本会导致apk没有网络权限,这unity真是死老冯了。
需要做三件事
第一
Go to Project Setting -> XR Plug-in Management -> Open XR
Under Android tab, in the OpenXR Feature Groups. Select the gear symbol for “Meta Quest Support” feature row. This will open the settings editor for that feature

In the settings editor, under “Feature Settings” section there is a sub-section called “Manifest Settings”
Uncheck the “Force Remove Internet” option under the “Manifest Setting” sub-section

第二
Set Internet Access to “Require” in the Projects Settings > Player > Android > Other Settings | Configuration

两步设置修改好后,clean build即可
第三
即使你已如此设置,unity仍然有可能会在导出apk包时去除网络权限,因此你可能还需要使用apk-editor-studio手动解包编译后的apk,手动向AndroidManifest.xml中添加以下两行:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
随后重新封包,并安装封包后的apk
参考:https://forum.unity.com/threads/unity-removes-android-permission-internet-in-the-build-apk-after-build-is-completed.1466654/