added support for few more arguments already existing in p4a

This commit is contained in:
Veselin Penev 2021-01-19 16:07:19 +01:00
parent 487a5979bf
commit 605cf522fd
3 changed files with 22 additions and 31 deletions

View file

@ -309,11 +309,7 @@ class Buildozer:
if get_stdout: if get_stdout:
ret_stdout.append(chunk) ret_stdout.append(chunk)
if show_output: if show_output:
try: stdout.write(chunk.decode('utf-8', 'replace'))
stdout.write(chunk.decode('utf-8', 'replace'))
except UnicodeEncodeError:
# attempt to solve encoding errors when output from external process is not "printable"
stdout.write(chunk.decode('utf-8', 'ignore'))
if fd_stderr in readx: if fd_stderr in readx:
chunk = process.stderr.read() chunk = process.stderr.read()
if not chunk: if not chunk:
@ -321,11 +317,7 @@ class Buildozer:
if get_stderr: if get_stderr:
ret_stderr.append(chunk) ret_stderr.append(chunk)
if show_output: if show_output:
try: stderr.write(chunk.decode('utf-8', 'replace'))
stderr.write(chunk.decode('utf-8', 'replace'))
except UnicodeEncodeError:
# attempt to solve encoding errors when output from external process is not "printable"
stderr.write(chunk.decode('utf-8', 'ignore'))
stdout.flush() stdout.flush()
stderr.flush() stderr.flush()

View file

@ -138,12 +138,20 @@ fullscreen = 0
# use that parameter together with android.entrypoint to set custom Java class instead of PythonActivity # use that parameter together with android.entrypoint to set custom Java class instead of PythonActivity
#android.activity_class_name = org.kivy.android.PythonActivity #android.activity_class_name = org.kivy.android.PythonActivity
# (str) Extra xml to write directly inside the <manifest> element of AndroidManifest.xml
# use that parameter to provide a filename from where to load your custom XML code
#android.extra_manifest_xml = ./src/android/extra_manifest.xml
# (str) Extra xml to write directly inside the <manifest><application> tag of AndroidManifest.xml
# 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) Full name including package path of the Java class that implements Python Service # (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 # use that parameter to set custom Java class instead of PythonService
#android.service_class_name = org.kivy.android.PythonService #android.service_class_name = org.kivy.android.PythonService
# (str) Android app theme, default is ok for Kivy-based app # (str) Android app theme, default is ok for Kivy-based app
#android.apptheme = "@android:style/Theme.NoTitleBar" # android.apptheme = "@android:style/Theme.NoTitleBar"
# (list) Pattern to whitelist for the whole project # (list) Pattern to whitelist for the whole project
#android.whitelist = #android.whitelist =
@ -203,16 +211,6 @@ fullscreen = 0
# (str) launchMode to set for the main activity # (str) launchMode to set for the main activity
#android.manifest.launch_mode = standard #android.manifest.launch_mode = standard
# (str) Add a Network Security Configuration file path to AndroidManifest.xml
# More info: https://developer.android.com/guide/topics/manifest/application-element#networkSecurityConfig
# File with desired network config must already exist in:
# ./pythonforandroid/bootstraps/sdl2/build/src/main/res/xml/network_security_config.xml
#android.manifest.network_security_config = "@xml/network_security_config"
# (str) Indicate that app intends to use cleartext network traffic in AndroidManifest.xml
# More info: https://developer.android.com/guide/topics/manifest/application-element#usesCleartextTraffic
#android.manifest.uses_cleartext_traffic = False
# (list) Android additional libraries to copy into libs/armeabi # (list) Android additional libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so #android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so #android.add_libs_armeabi_v7a = libs/android-v7/*.so

View file

@ -914,17 +914,18 @@ class TargetAndroid(Target):
if service_class_name != 'org.kivy.android.PythonService': if service_class_name != 'org.kivy.android.PythonService':
cmd.append('--service-class-name={}'.format(service_class_name)) cmd.append('--service-class-name={}'.format(service_class_name))
# support for network-security-config # support for extra-manifest-xml
network_security_config = self.buildozer.config.getdefault( extra_manifest_xml = self.buildozer.config.getdefault(
'app', 'android.manifest.network_security_config', None) 'app', 'android.extra_manifest_xml', '')
if network_security_config is not None: if extra_manifest_xml:
cmd.append("--network-security-config={}".format(network_security_config)) cmd.append('--extra-manifest-xml="{}"'.format(open(extra_manifest_xml, 'rt').read()))
# support for uses-cleartext-traffic # support for extra-manifest-application-arguments
uses_cleartext_traffic = self.buildozer.config.getdefault( extra_manifest_application_arguments = self.buildozer.config.getdefault(
'app', 'android.manifest.uses_cleartext_traffic', None) 'app', 'android.extra_manifest_application_arguments', '')
if uses_cleartext_traffic is not None: if extra_manifest_application_arguments:
cmd.append("--uses-cleartext-traffic={}".format('true' if uses_cleartext_traffic else 'false')) 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 gradle dependencies # support for gradle dependencies
gradle_dependencies = self.buildozer.config.getlist('app', 'android.gradle_dependencies', []) gradle_dependencies = self.buildozer.config.getlist('app', 'android.gradle_dependencies', [])