Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
185 views
in Technique[技术] by (71.8m points)

java - Use custom Manifest file and permission in Unity?

Im currently trying to program a little game for android with Unity3D. Because I want a visible status bar, I modified the AndroidManifest in the Project Folder (C:UsersPublicDocumentsUnity ProjectsProjectNameTempStagingArea) like this :

<application android:theme="Theme.Light.NoTitleBar" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">

But everytime i generate the APK, unity changes the Android Manifest to this :

<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">

Unity3D does change my modified Manifests everytime?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are modifying the wrong AndroidManifest file. That AndroidManifest from <ProjectName>TempStagingArea you are modifying is generated by unity each time you build your project.

To use a custom AndroidManifest file, you have to put your custom AndroidManifest file at <ProjectName>AssetsPluginsAndroid.

1.Go to <UnityInstallationDirecory>EditorDataPlaybackEnginesAndroidPlayerApk, Copy the AndroidManifest.xml file to your <ProjectName>AssetsPluginsAndroid

2.Open the copied Manifest file from <ProjectName>AssetsPluginsAndroid and add your manifest.

In your particular case, add <application android:theme="Theme.Light.NoTitleBar" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner"> to it. Save, Build and Run.

Unity will now use that AndroidManifest file. If you get crash or any other problem, then Unity does not want you to change that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...