You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Unity ARCore安卓应用发布失败:Android Manifest冲突求助

Unity ARFoundation 应用谷歌商店兼容设备为0的排查与解决

问题背景

发布Unity ARFoundation应用数周,谷歌商店始终显示0个兼容设备。商店反馈Manifest存在冲突,缺少android.hardware.autofocus、android.hardware.camera.ar、com.google.ar.core.depth特性,导致设备不兼容。已多次修改Manifest、测试并发布新版本,问题仍未解决。

用户提供的原始Manifest代码:

<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionName="1.0" android:versionCode="4" package="com.paradys.viewinterior" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:targetSdkVersion="31" android:minSdkVersion="25"/>

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <uses-feature android:required="true" android:glEsVersion="0x00030000"/>
    <uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="true"/>
    <uses-feature android:name="com.google.ar.core.depth" android:required="true"/>

    <application android:extractNativeLibs="true">
        <meta-data android:name="com.google.ar.core" android:value="required"/>

        <activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" android:screenOrientation="sensorPortrait" android:resizeableActivity="false" android:launchMode="singleTask" android:hardwareAccelerated="false" android:exported="true" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density">
            <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"/>
            <meta-data android:name="android.notch_support" android:value="true"/>
        </activity>

        <meta-data android:name="unity.splash-mode" android:value="0"/>
        <meta-data android:name="unity.splash-enable" android:value="True"/>
        <meta-data android:name="unity.launch-fullscreen" android:value="True"/>
        <meta-data android:name="unity.allow-resizable-window" android:value="False"/>
        <meta-data android:name="notch.config" android:value="portrait|landscape"/>
        <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true"/>
    </application>
</manifest>

用户合并后的Manifest代码:

<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionName="1.0" android:versionCode="5" android:targetSandboxVersion="2" android:installLocation="preferExternal" package="com.adamcherry.viewinterior" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:targetSdkVersion="31" android:minSdkVersion="25"/>
    <supports-screens android:xlargeScreens="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/>

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <uses-feature android:required="true" android:glEsVersion="0x00030000"/>
    <uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="true"/>
    <uses-feature android:name="com.google.ar.core.depth" android:required="true"/>

    <uses-permission android:name="android.permission.FLASHLIGHT"/>
    <uses-feature android:name="android.hardware.camera"/>
    <uses-feature android:name="android.hardware.autofocus"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>

    <queries>
        <package android:name="com.google.ar.core"/>
    </queries>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <application android:label="@string/app_name" android:icon="@mipmap/app_icon" android:extractNativeLibs="true" android:appComponentFactory="androidx.core.app.CoreComponentFactory">
        <meta-data android:name="com.google.ar.core" android:value="required"/>

        <activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" android:screenOrientation="sensorPortrait" android:resizeableActivity="false" android:launchMode="singleTask" android:hardwareAccelerated="false" android:exported="true" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density">
            <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"/>
            <meta-data android:name="android.notch_support" android:value="true"/>
        </activity>

        <meta-data android:name="unity.splash-mode" android:value="0"/>
        <meta-data android:name="unity.splash-enable" android:value="True"/>
        <meta-data android:name="unity.launch-fullscreen" android:value="True"/>
        <meta-data android:name="unity.allow-resizable-window" android:value="False"/>
        <meta-data android:name="notch.config" android:value="portrait|landscape"/>
        <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true"/>

        <meta-data android:name="com.google.ar.core.min_apk_version" android:value="210910000"/>
        <activity android:name="com.google.ar.core.InstallActivity" android:theme="@android:style/Theme.Material.Light.Dialog.Alert" android:launchMode="singleTop" android:exported="false" android:configChanges="keyboardHidden|orientation|screenSize" android:excludeFromRecents="true"/>

        <meta-data android:name="com.google.android.actions" android:resource="@xml/provider_paths"/>
        <provider android:name="androidx.core.content.FileProvider" android:exported="false" android:grantUriPermissions="true" android:authorities="com.adamcherry.viewinterior.provider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths"/>
        </provider>
    </application>
</manifest>

核心排查与修复步骤

  • 移除重复特性声明:合并版Manifest中重复声明了android.hardware.camera.autofocus,一处带required="true",一处无该属性。谷歌商店默认将无required的特性视为强制要求,重复声明会导致解析冲突,保留带required="true"的那一条即可。
  • 删除冗余的相机声明:ARCore依赖android.hardware.camera.ar,无需单独声明android.hardware.camera,否则会与ARCore的设备检测逻辑冲突,直接移除该声明。
  • 校验GL ES配置一致性:ARCore要求GL ES 3.0及以上,Manifest中的0x00030000声明正确,但需确保Unity打包设置(Player Settings > Other Settings > Rendering Path)选择OpenGLES3,避免配置不匹配。
  • 清理不必要权限:WRITE_EXTERNAL_STORAGE在Android 10+已被Scoped Storage替代,若未使用外部存储可直接移除;WAKE_LOCK若无需保持屏幕唤醒也可删除,减少不必要的设备限制。
  • 检查Unity Manifest合并规则:Unity会自动合并ARFoundation/ARCore的基础配置,手动修改的Manifest可能被覆盖。正确做法是在Assets/Plugins/Android目录下创建AndroidManifest.xml,仅添加自定义配置(如权限、元数据),打包后查看Temp/StagingArea/AndroidManifest.xml确认最终生成的Manifest无冲突。
  • 等待商店扫描周期:发布新版本后需等待2-4小时,谷歌商店需要时间重新扫描设备兼容性,不要立即查看结果。同时在商店后台的「设备兼容性」页面查看具体不兼容原因,针对性调整。

修正后的Manifest示例

<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionName="1.0" android:versionCode="6" android:targetSandboxVersion="2" android:installLocation="preferExternal" package="com.adamcherry.viewinterior" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:targetSdkVersion="31" android:minSdkVersion="25"/>
    <supports-screens android:xlargeScreens="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true"/>

    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.FLASHLIGHT"/>

    <uses-feature android:required="true" android:glEsVersion="0x00030000"/>
    <uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="true"/>
    <uses-feature android:name="com.google.ar.core.depth" android:required="true"/>

    <queries>
        <package android:name="com.google.ar.core"/>
    </queries>

    <application android:label="@string/app_name" android:icon="@mipmap/app_icon" android:extractNativeLibs="true" android:appComponentFactory="androidx.core.app.CoreComponentFactory">
        <meta-data android:name="com.google.ar.core" android:value="required"/>
        <meta-data android:name="com.google.ar.core.min_apk_version" android:value="210910000"/>

        <activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" android:screenOrientation="sensorPortrait" android:resizeableActivity="false" android:launchMode="singleTask" android:hardwareAccelerated="false" android:exported="true" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density">
            <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"/>
            <meta-data android:name="android.notch_support" android:value="true"/>
        </activity>

        <activity android:name="com.google.ar.core.InstallActivity" android:theme="@android:style/Theme.Material.Light.Dialog.Alert" android:launchMode="singleTop" android:exported="false" android:configChanges="keyboardHidden|orientation|screenSize" android:excludeFromRecents="true"/>

        <provider android:name="androidx.core.content.FileProvider" android:exported="false" android:grantUriPermissions="true" android:authorities="com.adamcherry.viewinterior.provider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths"/>
        </provider>

        <meta-data android:name="unity.splash-mode" android:value="0"/>
        <meta-data android:name="unity.splash-enable" android:value="True"/>
        <meta-data android:name="unity.launch-fullscreen" android:value="True"/>
        <meta-data android:name="unity.allow-resizable-window" android:value="False"/>
        <meta-data android:name="notch.config" android:value="portrait|landscape"/>
        <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true"/>
    </application>
</manifest>

内容的提问来源于stack exchange,提问作者Lichtarien

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 05:31:17