Skip to content

Commit 57f7436

Browse files
titoinclement
authored andcommitted
gradle dont show the name of the apk in its output. So in release mode, check first the non signed version. gradle build use env, not args.keystore
1 parent ca5e037 commit 57f7436

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

pythonforandroid/toolchain.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -811,16 +811,20 @@ def apk(self, args):
811811

812812
if not apk_file:
813813
info_main('# APK filename not found in build output, trying to guess')
814-
suffix = args.build_mode
815-
if suffix == 'release' and not args.keystore:
816-
suffix = suffix + '-unsigned'
817-
apks = glob.glob(join(apk_dir, apk_glob.format(suffix)))
818-
if len(apks) == 0:
814+
if args.build_mode == "release":
815+
suffixes = ("release", "release-unsigned")
816+
else:
817+
suffixes = ("debug", )
818+
for suffix in suffixes:
819+
apks = glob.glob(join(apk_dir, apk_glob.format(suffix)))
820+
if apks:
821+
if len(apks) > 1:
822+
info('More than one built APK found... guessing you '
823+
'just built {}'.format(apks[-1]))
824+
apk_file = apks[-1]
825+
break
826+
else:
819827
raise ValueError('Couldn\'t find the built APK')
820-
if len(apks) > 1:
821-
info('More than one built APK found... guessing you '
822-
'just built {}'.format(apks[-1]))
823-
apk_file = apks[-1]
824828

825829
info_main('# Found APK file: {}'.format(apk_file))
826830
if apk_add_version:

0 commit comments

Comments
 (0)