From 1ff55c4fca1f7d8e9eb81d20e8d514b9b9e61e6d Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 20 Feb 2020 11:59:38 +0100 Subject: [PATCH] add support for package.type and AAR library builds --- buildozer/targets/android.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 1dade48..9518ba6 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -784,6 +784,7 @@ class TargetAndroid(Target): build_cmd += [("--activity-launch-mode", launch_mode)] # build only in debug right now. + packagetype = config.get('app', 'package.type') if self.build_mode == 'debug': build_cmd += [("debug", )] mode = 'debug' @@ -791,7 +792,7 @@ class TargetAndroid(Target): else: build_cmd += [("release", )] mode_sign = "release" - mode = self.get_release_mode() + mode = mode_sign if packagetype == "library" else self.get_release_mode() self.execute_build_package(build_cmd) @@ -813,11 +814,13 @@ class TargetAndroid(Target): if is_gradle_build: # on gradle build, the apk use the package name, and have no version packagename = config.get('app', 'package.name') - apk = u'{packagename}-{mode}.apk'.format( - packagename=packagename, mode=mode) - apk_dir = join(dist_dir, "build", "outputs", "apk", mode_sign) - apk_dest = u'{packagename}-{version}-{mode}.apk'.format( - packagename=packagename, mode=mode, version=version) + pkgsuffix = 'aar' if packagetype == 'library' else 'apk' + apk = u'{packagename}-{mode}.{extension}'.format( + packagename=packagename, mode=mode, extension=pkgsuffix) + apk_dir = join(dist_dir, "build", "outputs", pkgsuffix, + ('' if packagetype == 'library' else mode_sign)) + apk_dest = u'{packagename}-{version}-{mode}.{extension}'.format( + packagename=packagename, mode=mode, version=version, extension=pkgsuffix) else: # on ant, the apk use the title, and have version