Merge "Revert^2 "Fix signing failure for split APKs"" into main
This commit is contained in:
@@ -2434,12 +2434,23 @@ def GetMinSdkVersion(apk_name):
|
||||
"Failed to obtain minSdkVersion for {}: aapt2 return code {}:\n{}\n{}".format(
|
||||
apk_name, proc.returncode, stdoutdata, stderrdata))
|
||||
|
||||
is_split_apk = False
|
||||
for line in stdoutdata.split("\n"):
|
||||
# See b/353837347 , split APKs do not have sdk version defined,
|
||||
# so we default to 21 as split APKs are only supported since SDK
|
||||
# 21.
|
||||
if (re.search(r"split=[\"'].*[\"']", line)):
|
||||
is_split_apk = True
|
||||
# Due to ag/24161708, looking for lines such as minSdkVersion:'23',minSdkVersion:'M'
|
||||
# or sdkVersion:'23', sdkVersion:'M'.
|
||||
m = re.match(r'(?:minSdkVersion|sdkVersion):\'([^\']*)\'', line)
|
||||
if m:
|
||||
return m.group(1)
|
||||
if is_split_apk:
|
||||
logger.info("%s is a split APK, it does not have minimum SDK version"
|
||||
" defined. Defaulting to 21 because split APK isn't supported"
|
||||
" before that.", apk_name)
|
||||
return 21
|
||||
raise ExternalError("No minSdkVersion returned by aapt2 for apk: {}".format(apk_name))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user