测试版本为Unity2017.4.25f1
1.在自定义AndroidManifest.xml(位于Assets\Plugins\Android\)中添加android:exported="true"
- "1.0" encoding="utf-8"?>
- <manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.unity3d.player"
- xmlns:tools="http://schemas.android.com/tools"
- android:installLocation="preferExternal"
- android:versionCode="1"
- android:versionName="1.0">
- <supports-screens
- android:smallScreens="true"
- android:normalScreens="true"
- android:largeScreens="true"
- android:xlargeScreens="true"
- android:anyDensity="true"/>
- <application
- android:theme="@style/UnityThemeSelector"
- android:icon="@drawable/app_icon"
- android:label="@string/app_name"
- android:requestLegacyExternalStorage="true">
- <activity android:name="com.unity3d.player.UnityPlayerActivity"
- android:label="@string/app_name"
- android:exported="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- intent-filter>
- <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
- activity>
- application>
- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE">uses-permission>
- <uses-permission android:name="android.permission.CHANGE_WIFI_STATE">uses-permission>
- <uses-permission android:name="android.permission.INTERNET">uses-permission>
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">uses-permission>
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">uses-permission>
- <uses-permission android:name="android.permission.WRITE_SETTINGS">uses-permission>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
- manifest>
2.在菜单File>Build Settings...>PlayerSettings...>Other Settings,勾选Mute Other Audio Source*
.
3.通过以上两步应该就可以在安卓12上运行了。如果还不行就加上签名再试试。