Build error for gear vr app involving manifest in mac os

I am getting the following error when trying to build the sample vr assets.

/Users/admin/vrdemo3/Temp/StagingArea/AndroidManifest-main.xml:4:125-150 Error:
	Attribute application@debuggable value=(true) from AndroidManifest-main.xml:4:125-150
	is also present at AndroidManifest.xml:3:148-174 value=(false).
	Suggestion: add 'tools:replace="android:debuggable"' to <application> element at AndroidManifest-main.xml:4:3-12:17 to override.
/Users/admin/vrdemo3/Temp/StagingArea/AndroidManifest-main.xml:4:16-57 Error:
	Attribute application@theme value=(@style/UnityThemeSelector) from AndroidManifest-main.xml:4:16-57
	is also present at AndroidManifest.xml:3:83-147 value=(@android:style/Theme.Black.NoTitleBar.Fullscreen).
	Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest-main.xml:4:3-12:17 to override.

UnityEditor.HostView:OnGUI()


AndroidSDKToolsException: Unable to merge android manifests. See the Console for more details. 
UnityEditor.Android.AndroidSDKTools.DetectErrorsAndWarnings (System.String logMessages, System.String errorMsg)
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)
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)
UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[] sdkToolCommand, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommand (System.String[] sdkToolCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.MergeManifests (System.String target, System.String mainManifest, System.String[] libraryManifests, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.PostProcessor.Tasks.GenerateManifest.MergeManifests (UnityEditor.Android.PostProcessor.PostProcessorContext context, System.String targetManifest, System.String mainManifest)
UnityEditor.Android.PostProcessor.Tasks.GenerateManifest.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.HostView:OnGUI()

UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:162 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:83 
UnityEditor.HostView:OnGUI()

I am using Unity 2017.1.0f3, and trying to deploy to Samsung Galaxy S8+ (which is running Nougat 7.0)

I have followed the suggestion of copying the AndroidManifest-main.xml to the {Assets}/Plugins/Android/
folder in order to override the temp project manifest and I have inserted the following
tools:replace=“android:theme”
and
tools:replace=“android:debuggable”
in the application element, but this has not prevented the error. Is there somewhere else that I need to change or is it possible to set the them and debuggable flags elsewhere to prevent the conflict from occurring?

I managed to get the manifest to merge by adding the 'tools:replace=“android:theme” to the Unity Player androidmanifest.xml. I had seen other solutions suggesting to change the order of libraries in the Gradle build files but was unable to do this as I am using the internal build tools rather than Gradle.
Hope this helps someone else.