Sudden error Unable to merge android manifests.

yesterday app was building successfully in cloud build… now after it has error and I did not do any in like adding plugins just editing normal script…

Also I can build locally and works fine…im using windows pc…
unity 5.6.2f1…

20747: [Unity] /BUILD_PATH/samwit.banker-app-game.default-android/Temp/StagingArea/AndroidManifest-main.xml:5:16-49 Error:
20748: [Unity] Attribute application@icon value=(@drawable/app_icon) from AndroidManifest-main.xml:5:16-49
20749: [Unity] is also present at AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher).
20750: [Unity] Suggestion: add ‘tools:replace=“android:icon”’ to element at AndroidManifest-main.xml:5:3-14:17 to override.
20751: [Unity] /BUILD_PATH/samwit.banker-app-game.default-android/Temp/StagingArea/AndroidManifest-main.xml:11:4-51 Error:
20752: [Unity] Attribute application@theme value=(@android:style/Theme.NoTitleBar) from AndroidManifest.xml:11:4-51
20753: [Unity] is also present at AndroidManifest.xml:15:9-40 value=( @ /AppTheme).
20754: [Unity] Suggestion: add ‘tools:replace=“android:theme”’ to element at AndroidManifest-main.xml:5:3-14:17 to override.
20755: [Unity] UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
20756: [Unity] UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[ ])
20757: [Unity] UnityEngine.Logger:Log(LogType, Object)
20758: [Unity] UnityEngine.Debug:LogError(Object)
20759: [Unity] UnityEditor.Android.AndroidSDKTools:smile:etectErrorsAndWarnings(String, String)
20760: [Unity] UnityEditor.Android.AndroidSDKTools:RunCommandInternal(String, String, String[ ], Int32, String, WaitingForProcessToExit, String)
20761: [Unity] UnityEditor.Android.AndroidSDKTools:RunCommandSafe(String, String, String[ ], Int32, String, WaitingForProcessToExit, String)
20762: [Unity] UnityEditor.Android.AndroidSDKTools:RunCommand(String[ ], Int32, String, WaitingForProcessToExit, String)
20763: [Unity] UnityEditor.Android.AndroidSDKTools:RunCommand(String[ ], String, WaitingForProcessToExit, String)
20764: [Unity] UnityEditor.Android.AndroidSDKTools:RunCommand(String[ ], WaitingForProcessToExit, String)
20765: [Unity] UnityEditor.Android.AndroidSDKTools:MergeManifests(String, String, String[ ], WaitingForProcessToExit)
20766: [Unity] UnityEditor.Android.PostProcessor.Tasks.GenerateManifest:MergeManifests(PostProcessorContext, String, String)
20767: [Unity] UnityEditor.Android.PostProcessor.Tasks.GenerateManifest:Execute(PostProcessorContext)
20768: [Unity] UnityEditor.Android.PostProcessor.PostProcessRunner:RunAllTasks(PostProcessorContext)
20769: [Unity] UnityEditor.Android.PostProcessAndroidPlayer:PostProcess(BuildTarget, String, String, String, String, String, String, BuildOptions, RuntimeClassRegistry)
20770: [Unity] UnityEditor.Android.AndroidBuildPostprocessor:PostProcess(BuildPostProcessArgs)
20771: [Unity] UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[ ], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
20772: [Unity] UnityEditor.CloudBuild.Builder:Build()
20773: [Unity] Cancelling DisplayDialog: Build failure Unable to merge android manifests. See the Console for more details.
20774: [Unity] This should not be called in batch mode.
20775: [Unity] UnityEditor.EditorUtility:smile:isplayDialog(String, String, String, String)
20776: [Unity] UnityEditor.Android.PostProcessor.PostProcessRunner:RunAllTasks(PostProcessorContext)
20777: [Unity] UnityEditor.Android.PostProcessAndroidPlayer:PostProcess(BuildTarget, String, String, String, String, String, String, BuildOptions, RuntimeClassRegistry)
20778: [Unity] UnityEditor.Android.AndroidBuildPostprocessor:PostProcess(BuildPostProcessArgs)
20779: [Unity] UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[ ], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
20780: [Unity] UnityEditor.CloudBuild.Builder:Build()
20781: [Unity] AndroidSDKToolsException: Unable to merge android manifests. See the Console for more details.
20782: [Unity] at UnityEditor.Android.AndroidSDKTools.DetectErrorsAndWarnings (System.String logMessages, System.String errorMsg) [0x00000] in :0
20783: [Unity] at UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[ ] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in :0
20784: [Unity] at UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[ ] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in :0
20785: [Unity] at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[ ] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in :0
20786: [Unity] at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[ ] sdkToolCommand, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in :0
20787: [Unity] at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[ ] sdkToolCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in :0

Similar happening for us…builds were working fine yesterday and broken today. Error we’re seeing (I removed our company name in the path):

XmlException: 'tools' is undeclared namespace. file:///BUILD_PATH/companynameremoved//Temp/StagingArea/AndroidManifest.xml Line 13, position 179.
18732: [Unity]   at Mono.Xml2.XmlTextReader.ReadStartTag () [0x00000] in <filename unknown>:0
18733: [Unity]   at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
18734: [Unity]   at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
18735: [Unity]   at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
18736: [Unity]   at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
18737: [Unity]   at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
18738: [Unity]   at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
18739: [Unity]   at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00000] in <filename unknown>:0
18740: [Unity]   at UnityEditor.AndroidXmlDocument..ctor (System.String path) [0x00000] in <filename unknown>:0
18741: [Unity]   at UnityEditor.AndroidManifest..ctor (System.String path) [0x00000] in <filename unknown>:0
18742: [Unity]   at UnityEditor.Android.PostProcessor.Tasks.GenerateManifest.PatchManifest (UnityEditor.Android.PostProcessor.PostProcessorContext context, System.String manifest) [0x00000] in <filename unknown>:0
18743: [Unity]   at UnityEditor.Android.PostProcessor.Tasks.GenerateManifest.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
18744: [Unity]   at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00000] in <filename unknown>:0
18745: [Unity]   at UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) [0x00000] in <filename unknown>:0
18746: [Unity]   at UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args) [0x00000] in <filename unknown>:0

We are the same.
I has not been updated the master branch of Git, and rebuilt it today, the following error occurred.

[Unity] XmlException: ‘tools’ is undeclared namespace. file:///BUILD_PATH/-------------------------/Temp/StagingArea/AndroidManifest.xml Line 10, position 1

I added xmlns:tools=“http://schemas.android.com/tools” to the manifest tag in our android manifest and that seems to work. Not sure why it’s only just breaking today, but this is a decent fix for now

8 Likes

Same problem here

Thank you!

I corrected it the same way, it seems to be working normally.

However, since it can be built locally, I do not know why it stopped working.

It may be modified by Unity’s team.

Just updated cloud build from unity 5.6.0f3 to 5.6.3p1 and we got :

Adding

on AndroidManifest (Assets/Plugins/Android/AndroidManifest.xml) did the trick…

any from unity team?

[QUOTE=Adding on AndroidManifest (Assets/Plugins/Android/AndroidManifest.xml) did the trick…[/QUOTE]

did not work from me

same problem here

Thanks, man. You’re a legend. Works now

3 Likes

We’re on 5.6.3p1, is it possible for you to try that and see if it builds? Also, did you try the second suggestion in your console output?

20750: [Unity] Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest-main.xml:5:3-14:17 to override.

It might be that the tools reference is ignored if it isn’t then used anywhere (just guessing I’m afraid)?

thank you for reply but I dont know how to add it in my manifest , here my sample android manifest

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-sdk android:targetSdkVersion="26" />
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false">
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 216817929098" />
    <receiver android:name="com.androidnative.features.notifications.LocalNotificationReceiver" android:enabled="true" android:exported="true">
      <intent-filter>
        <action android:name="com.androidnative.local.intent.OPEN" />
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    </receiver>
    <service android:name="com.androidnative.features.notifications.LocalNotificationService" />
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name">
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name="com.androidnative.AndroidNativeProxy" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.androidnative.OAuthProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.androidnative.gms.core.GooglePlaySupportActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />
    <activity android:name="com.androidnative.features.social.common.SocialProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
  </application>
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.GET_TASKS" />
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
</manifest>

Going just by the suggestions in your console output, you could try :

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.unity3d.player" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-sdk android:targetSdkVersion="26" />
  <application tools:replace="android:icon" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false">
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 216817929098" />
    <receiver android:name="com.androidnative.features.notifications.LocalNotificationReceiver" android:enabled="true" android:exported="true">
      <intent-filter>
        <action android:name="com.androidnative.local.intent.OPEN" />
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    </receiver>
    <service android:name="com.androidnative.features.notifications.LocalNotificationService" />
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name">
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name="com.androidnative.AndroidNativeProxy" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.androidnative.OAuthProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.androidnative.gms.core.GooglePlaySupportActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />
    <activity android:name="com.androidnative.features.social.common.SocialProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
  </application>
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.GET_TASKS" />
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
</manifest>

Thank you for reply…will try this one :slight_smile:

If those changes don’t help: I just ran a test with the version 5.6.2f1 of Unity and the build fails with manifest issues. Pointing back to 5.6.3p1 works again fine, if you can update to that version it might solve your problem for now (as long as you include xmlns:tools=“http://schemas.android.com/tools” in your manifest tag).

On a side note, the cloud build manifest also seems to add extra permissions that we don’t want (these aren’t in our manifest and don’t appear in local builds)

<android:uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <android:uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Same problem. xmlns:tools=“http://schemas.android.com/tools” hasn’t solved my problem on Unity 5.5.4p3.

10: [Unity] AndroidSDKToolsException: Unable to merge android manifests. See the Console for more details.
11: [Unity]   at UnityEditor.Android.AndroidSDKTools.DetectErrorsAndWarnings (System.String logMessages, System.String errorMsg) [0x00000] in <filename unknown>:0
12: [Unity]   at UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
13: [Unity]   at UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
14: [Unity]   at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
15: [Unity]   at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[] sdkToolCommand, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
16: [Unity]   at UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[] sdkToolCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

After upgrade to Unity 5.6.3f1 , my problem had solved.

getting another problem…after last fix getting this error
and I already add but did not work

Unity] /BUILD_PATH/samwit.banker-app-game.default-android/Temp/StagingArea/AndroidManifest-main.xml:11:4-51 Error:
11847: [Unity] Attribute application@theme value=(@android:style/Theme.NoTitleBar) from AndroidManifest.xml:11:4-51
11848: [Unity] is also present at AndroidManifest.xml:15:9-40 value=( @ /AppTheme).
11849: [Unity] Suggestion: add ‘tools:replace=“android:theme”’ to element at AndroidManifest-main.xml:5:3-29:17 to override.
11850: [Unity] UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
11851: [Unity] UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[ ])
11852: [Unity] UnityEngine.Logger:Log(LogType, Object)
11853: [Unity] UnityEngine.Debug:LogError(Object)

I see this too! I thought I was going crazy. Can someone at Unity comment on where READ_PHONE_STATE is coming from and why?