简体   繁体   English

Android Unity插件清单

[英]Android Unity Plugin Manifest

I am working on a Unity plugin and I need to set 我正在使用Unity插件,需要设置

<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />

in the AndroidManifest.xml in the <Activity> tag. <Activity>标签的AndroidManifest.xml中。 I would prefer to set this in the plugin manifest and have it add it to the project manifest instead of having the user add it themselves. 我希望在插件清单中进行设置,然后将其添加到项目清单中,而不是让用户自己添加它。 Is there any way to do this? 有什么办法吗?

This is a late answer and maybe you've already figured it out. 这是一个较晚的答案,也许您已经知道了。 You can include this AndroidManifest.xml file in the Unity project, here is the path: YourProjectname/Assets/Plugins/AndroidManifest.xml 您可以在Unity项目中包含这个AndroidManifest.xml文件,这是路径:YourProjectname / Assets / Plugins / AndroidManifest.xml

When you build the project for Android, you can double check the AndroidManifest.xml in YourProjectname/Temp/StagingArea/AndroidManifest.xml which is the final setting for your apk file. 当您为Android构建项目时,可以在YourProjectname / Temp / StagingArea / AndroidManifest.xml中再次检查AndroidManifest.xml,这是apk文件的最终设置。 Hope that helps! 希望有帮助!

Here is the AndroidManifest built with unity 2018.3 这是用Unity 2018.3构建的AndroidManifest

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        android:label="@string/app_name"
        android:icon="@drawable/app_icon">

        <activity
            android:name="com.unity3d.player.UnityPlayerActivity"
     android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">

            <intent-filter>

                <action
                    android:name="android.intent.action.MAIN" />

                <category
                    android:name="android.intent.category.LAUNCHER" />

                <category
                    android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>

            <meta-data
                android:name="unityplayer.UnityActivity"
                android:value="true" />
        </activity>
    </application>
</manifest>

Add any meta-data tags you need in this AndroidManifest.xml file and place this at /Assets/Plugins/Android/AndroidManifest.xml 在此AndroidManifest.xml文件中添加所需的任何元数据标签,并将其放在/Assets/Plugins/Android/AndroidManifest.xml中

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM