Skip to content

Commit 421657d

Browse files
committed
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 32cc7e1 commit 421657d

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
@@ -797,16 +797,20 @@ def apk(self, args):
797797

798798
if not apk_file:
799799
info_main('# APK filename not found in build output, trying to guess')
800-
suffix = args.build_mode
801-
if suffix == 'release' and not args.keystore:
802-
suffix = suffix + '-unsigned'
803-
apks = glob.glob(join(apk_dir, apk_glob.format(suffix)))
804-
if len(apks) == 0:
800+
if args.build_mode == "release":
801+
suffixes = ("release", "release-unsigned")
802+
else:
803+
suffixes = ("debug", )
804+
for suffix in suffixes:
805+
apks = glob.glob(join(apk_dir, apk_glob.format(suffix)))
806+
if apks:
807+
if len(apks) > 1:
808+
info('More than one built APK found... guessing you '
809+
'just built {}'.format(apks[-1]))
810+
apk_file = apks[-1]
811+
break
812+
else:
805813
raise ValueError('Couldn\'t find the built APK')
806-
if len(apks) > 1:
807-
info('More than one built APK found... guessing you '
808-
'just built {}'.format(apks[-1]))
809-
apk_file = apks[-1]
810814

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

0 commit comments

Comments
 (0)