Merge pull request #1275 from vesellov/master

added few additional options for android p4a builds
This commit is contained in:
Akshay Arora 2021-08-17 22:55:16 +05:30 committed by GitHub
commit 643d19af4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 1 deletions

View file

@ -136,7 +136,23 @@ fullscreen = 0
# android.accept_sdk_license = False
# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity
#android.entrypoint = org.kivy.android.PythonActivity
# (str) Full name including package path of the Java class that implements Android Activity
# use that parameter together with android.entrypoint to set custom Java class instead of 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
# use that parameter to set custom Java class instead of PythonService
#android.service_class_name = org.kivy.android.PythonService
# (str) Android app theme, default is ok for Kivy-based app
# android.apptheme = "@android:style/Theme.NoTitleBar"

View file

@ -100,6 +100,12 @@ class TargetAndroid(Target):
else:
self.extra_p4a_args += ' --ignore-setup-py'
activity_class_name = self.buildozer.config.getdefault(
'app', 'android.activity_class_name', 'org.kivy.android.PythonActivity')
if activity_class_name != 'org.kivy.android.PythonActivity':
self.extra_p4a_args += ' --activity-class-name={}'.format(activity_class_name)
if self.buildozer.log_level >= 2:
self.extra_p4a_args += ' --debug'
@ -899,6 +905,31 @@ class TargetAndroid(Target):
for lib in uses_library:
cmd.append('--uses-library={}'.format(lib))
# support for activity-class-name
activity_class_name = self.buildozer.config.getdefault(
'app', 'android.activity_class_name', 'org.kivy.android.PythonActivity')
if activity_class_name != 'org.kivy.android.PythonActivity':
cmd.append('--activity-class-name={}'.format(activity_class_name))
# support for service-class-name
service_class_name = self.buildozer.config.getdefault(
'app', 'android.service_class_name', 'org.kivy.android.PythonService')
if service_class_name != 'org.kivy.android.PythonService':
cmd.append('--service-class-name={}'.format(service_class_name))
# support for extra-manifest-xml
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()))
# support for extra-manifest-application-arguments
extra_manifest_application_arguments = self.buildozer.config.getdefault(
'app', 'android.extra_manifest_application_arguments', '')
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 gradle dependencies
gradle_dependencies = self.buildozer.config.getlist('app', 'android.gradle_dependencies', [])
for gradle_dependency in gradle_dependencies: