Skip to content

Commit 306caff

Browse files
committed
fix: update APK download logic to use correct generatedSplitApks structure
- Changed from looking for generatedUniversalApK field to generatedSplitApks array - Look for base module with variantId=1 and no splitId to identify universal APK - Added better debugging output to understand API response structure - Fixed duplicate download_id validation
1 parent 6919b9d commit 306caff

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -462,34 +462,34 @@ jobs:
462462
print(f" {key}: {value}")
463463
print()
464464
465-
# Find universal APK and get downloadId
465+
# Find universal APK in generatedSplitApks (based on API debug output)
466+
download_id = None
466467
universal_apk = None
467-
for apk in result['generatedApks']:
468-
targeting_info = apk.get('targetingInfo', {})
469-
# Universal APK typically has no targeting info or minimal targeting
470-
if (not targeting_info.get('abiTargeting') and
471-
not targeting_info.get('screenDensityTargeting') and
472-
not targeting_info.get('languageTargeting')):
473-
universal_apk = apk
474-
break
475468
476-
if not universal_apk:
477-
# Fallback: try to find any APK that looks universal
478-
for apk in result['generatedApks']:
479-
if not apk.get('targetingInfo', {}).get('abiTargeting'):
480-
universal_apk = apk
469+
for apk in result['generatedApks']:
470+
if 'generatedSplitApks' in apk:
471+
split_apks = apk['generatedSplitApks']
472+
print(f"Found {len(split_apks)} split APKs")
473+
474+
# Look for the base/universal APK - typically variantId=1, moduleName='base'
475+
for split_apk in split_apks:
476+
print(f"Split APK: variantId={split_apk.get('variantId')}, moduleName={split_apk.get('moduleName')}")
477+
# Universal APK is typically the base module without splitId
478+
if (split_apk.get('moduleName') == 'base' and
479+
split_apk.get('variantId') == 1 and
480+
'splitId' not in split_apk):
481+
download_id = split_apk.get('downloadId')
482+
universal_apk = split_apk
483+
print(f"Found universal APK: {universal_apk}")
484+
break
485+
486+
if download_id:
481487
break
482488
483-
if not universal_apk:
484-
print("Universal APK not found in generated APKs")
485-
print("Available APKs:")
486-
for i, apk in enumerate(result['generatedApks']):
487-
print(f" APK {i}: {apk.get('targetingInfo', 'No targeting info')}")
488-
return False
489-
490-
download_id = universal_apk.get('downloadId')
491489
if not download_id:
492-
print("Download ID not available for universal APK")
490+
print("Universal APK not found in generatedSplitApks")
491+
print("Available APK structure:")
492+
print(json.dumps(result['generatedApks'], indent=2))
493493
return False
494494
495495
print(f"Found universal APK with downloadId: {download_id}")

0 commit comments

Comments
 (0)