From fbf9371cabc31bcd2c7fba2b54675022ba3e2141 Mon Sep 17 00:00:00 2001 From: Curtis Kaulback <92492424+Craulback@users.noreply.github.com> Date: Tue, 29 Mar 2022 12:19:07 -0600 Subject: [PATCH] Add write extra xml inside application element option Add write extra xml inside application element option --- buildozer/default.spec | 4 ++++ buildozer/targets/android.py | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index 677b59be4..ce2eca232 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -151,6 +151,10 @@ fullscreen = 0 # use that parameter to provide a filename from where to load your custom XML arguments: #android.extra_manifest_application_arguments = ./src/android/extra_manifest_application_arguments.xml +# (str) Extra xml to write directly inside the element of AndroidManifest.xml +# use that parameter to provide a filename from where to load your custom XML arguments: +# android.extra_manifest_application_xml = ./src/android/extra_manifest_application.xml + # (str) Full name including package path of the Java class that implements Python Service # use that parameter to set custom Java class instead of PythonService #android.service_class_name = org.kivy.android.PythonService diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index e44871dbe..fe6826126 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -956,7 +956,7 @@ def execute_build_package(self, build_cmd): extra_manifest_xml = self.buildozer.config.getdefault( 'app', 'android.extra_manifest_xml', '') if extra_manifest_xml: - cmd.append('--extra-manifest-xml="{}"'.format(open(extra_manifest_xml, 'rt').read())) + cmd.append('--extra-manifest-xml="{}"'.format(open(extra_manifest_xml, 'rt').read().replace('"', '\\"'))) # support for extra-manifest-application-arguments extra_manifest_application_arguments = self.buildozer.config.getdefault( @@ -964,6 +964,13 @@ def execute_build_package(self, build_cmd): if extra_manifest_application_arguments: args_body = open(extra_manifest_application_arguments, 'rt').read().replace('"', '\\"').replace('\n', ' ').replace('\t', ' ') cmd.append('--extra-manifest-application-arguments="{}"'.format(args_body)) + + # support for extra-manifest-application-xml + extra_manifest_application_xml = self.buildozer.config.getdefault( + 'app', 'android.extra_manifest_application_xml', '') + if extra_manifest_application_xml: + args_body = open(extra_manifest_application_xml, 'rt').read().replace('"', '\\"') + cmd.append('--extra-manifest-application-xml="{}"'.format(args_body)) # support for gradle dependencies gradle_dependencies = self.buildozer.config.getlist('app', 'android.gradle_dependencies', [])