Unity Android清单合并问题

时间:2018-07-20 20:57:51

标签: android unity3d android-manifest

我正在尝试构建一个android应用,但是合并清单时出了点问题。当我检查以下内容:

  

PROJECT \ Temp \ StagingArea \ AndroidManifest.xml

与旧版相比,我的清单似乎缺少一些内容。据我所知,最终清单应包含here中所述的Unity“ part”和其他插件(在我的情况下为Google Play Games)中的元素。在“ Unity如何产生Android清单”部分中。当我查看实际的清单时,我可以发现该行丢失了:

<meta-data android:name="com.google.android.gms.games.unityVersion"
            android:value="\ 0.9.50" />

,但是似乎还有更多缺少的东西,但是我完全不知道哪个(大约12行)。发生的第二件事是缺少“应用”图标。

我已经尝试过:

  • 资产-> Play服务解析器-> Android解析器->强制解析

  • 添加手动丢失的行是命中或遗漏的方法。

Google Play游戏插件清单:

<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by the Google Play Games plugin for Unity
     Do not edit. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.example.games.mainlibproj"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />



    <application>



        <!-- The space in these forces it to be interpreted as a string vs. int -->
        <meta-data android:name="com.google.android.gms.games.APP_ID"
            android:value="\ {MY_ID}" />

        <!-- Keep track of which plugin is being used -->
        <meta-data android:name="com.google.android.gms.games.unityVersion"
            android:value="\ 0.9.50" />

        <activity android:name="com.google.games.bridge.NativeBridgeActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    </application>
</manifest>

最终清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="{package name}" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:isGame="true">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
      <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>
    <meta-data android:name="unity.build-id" android:value="{build id}" />
    <meta-data android:name="unity.splash-mode" android:value="0" />
    <meta-data android:name="unity.splash-enable" android:value="True" />
  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>

Unity Cloud Build服务正在构建良好的最终清单(我使用apktool从.apk取回它):

<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="{package name}">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true"/>
    <uses-feature android:glEsVersion="0x00020000"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false"/>
    <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false"/>
    <uses-permission android:name="com.android.vending.BILLING"/>
    <uses-feature android:name="android.software.vr.mode" android:required="false"/>
    <uses-feature android:name="android.software.vr.high_performance" android:required="false"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <application android:allowBackup="true" android:icon="@mipmap/app_icon" android:isGame="true" android:label="@string/app_name" android:theme="@style/UnityThemeSelector">
        <activity android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="false" android:label="@string/app_name" android:launchMode="singleTask" android:name="com.unity3d.player.UnityPlayerActivity" android:screenOrientation="portrait">
            <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>
        <meta-data android:name="unity.build-id" android:value="{build id}"/>
        <meta-data android:name="unity.splash-mode" android:value="0"/>
        <meta-data android:name="unity.splash-enable" android:value="true"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:name="com.unity.purchasing.googleplay.PurchaseActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:enableVrMode="com.google.vr.vrcore/com.google.vr.vrcore.common.VrCoreListenerService" android:name="com.unity.purchasing.googleplay.VRPurchaseActivity" android:theme="@style/VrActivityTheme">
            <intent-filter>
                <action android:name="com.google.vr.vrcore.ACTION_NONE"/>
                <category android:name="com.google.intent.category.DAYDREAM"/>
            </intent-filter>
        </activity>
        <activity android:excludeFromRecents="true" android:exported="false" android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
        <service android:exported="true" android:name="com.google.android.gms.auth.api.signin.RevocationBoundService" android:permission="com.google.android.gms.auth.api.signin.permission.REVOCATION_NOTIFICATION"/>
        <activity android:exported="false" android:name="com.google.android.gms.common.api.GoogleApiActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
        <receiver android:name="com.hippogames.simpleandroidnotifications.Controller"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="true" android:name="com.unity3d.ads.adunit.AdUnitActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="true" android:name="com.unity3d.ads.adunit.AdUnitTransparentActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="false" android:name="com.unity3d.ads.adunit.AdUnitTransparentSoftwareActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:hardwareAccelerated="false" android:name="com.unity3d.ads.adunit.AdUnitSoftwareActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
        <meta-data android:name="com.google.android.gms.games.APP_ID" android:value=" {app id}"/>
        <meta-data android:name="com.google.android.gms.games.unityVersion" android:value=" 0.9.50"/>
        <activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
    </application>
</manifest>

我想使用编辑器来构建与之前/统一云构建相同的清单

1 个答案:

答案 0 :(得分:0)

复制AndroidManifest.xml并将其放置在文件夹中。

  

要使用您在Unity之外创建的Android清单,

     

将您的Android Manifest文件导入以下位置:   资产/插件/Android/AndroidManifest.xml

     

这会覆盖默认的Unity创建的清单。

Unity Override Android Manifest