fix(tester): parse bare Android package identity
This commit is contained in:
@@ -304,6 +304,10 @@ def android_identity(path: Path, context: RuntimeContext) -> str:
|
||||
result = run_command(command, context=context)
|
||||
if result.code == 0:
|
||||
match = re.search(r"(?:name|application-id)[=:]['\"]?([A-Za-z0-9_.]+)", result.output)
|
||||
if not match:
|
||||
# apkanalyzer manifest application-id prints the bare package
|
||||
# name, while aapt/aapt2 print a package: name=... record.
|
||||
match = re.fullmatch(r"\s*([A-Za-z0-9_.]+)\s*", result.output)
|
||||
if match:
|
||||
return match.group(1)
|
||||
raise EnvironmentFailure("APK 身份读取失败;请检查 Android SDK build-tools")
|
||||
|
||||
Reference in New Issue
Block a user