installing-and-managing-apps
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInstalling and Managing Apps — adb install
and pm
adb installpm安装和管理应用 — adb install
与 pm
adb installpmApp lifecycle from the host. ships an APK; is the on-device PackageManager front-end that lists, paths, clears, enables/disables, and grants permissions. The most common subtle bug in test scaffolding is using to "reset" an app between tests — that command kills the process but leaves SharedPreferences, the Room DB, and files on disk. The hermetic equivalent is .
adb installpmam force-stoppm clear从主机端管理应用生命周期。 用于传送 APK; 是设备端的 PackageManager 前端,用于列出包、查找路径、清除数据、启用或禁用应用以及授予权限。测试脚手架中最常见的细微错误,是使用 在测试之间“重置”应用——该命令只会终止进程,但会保留 SharedPreferences、Room DB 以及磁盘上的文件。实现隔离的等价方式是 。
adb installpmam force-stoppm clearWhen to use this skill
何时使用此 skill
- The user wants to install an APK from the host or push a debug build between every test run.
- The user asks "how do I reset the app's state between tests?" or sees stale data carry over from one test to the next.
- The user hits ,
INSTALL_FAILED_VERSION_DOWNGRADE, or signature mismatch errors.INSTALL_FAILED_USER_RESTRICTED - The user wants to grant all runtime permissions at install (), or grant/revoke a single permission post-install.
-g - The user wants to list only third-party packages, find an APK on disk, or dump a Baseline Profile.
- 用户希望从主机安装 APK,或在每次测试运行之间推送 debug build。
- 用户询问“如何在测试之间重置应用状态?”或发现旧数据从一次测试延续到下一次测试。
- 用户遇到 、
INSTALL_FAILED_VERSION_DOWNGRADE或签名不匹配错误。INSTALL_FAILED_USER_RESTRICTED - 用户希望在安装时授予所有运行时权限(),或在安装后授予或撤销单个权限。
-g - 用户希望仅列出第三方包、查找磁盘上的 APK,或转储 Baseline Profile。
When NOT to use this skill
何时不应使用此 skill
- The user wants to actually run instrumented tests against the installed app — use .
../../tests/running-instrumented-tests-via-adb/SKILL.md - The user wants to choose a device or wait for boot — use .
../../devices/connecting-to-devices/SKILL.md - The user wants the architecture / environment / authentication picture — use .
../../architecture/understanding-adb-architecture/SKILL.md
- 用户希望针对已安装的应用实际运行插桩测试——请使用 。
../../tests/running-instrumented-tests-via-adb/SKILL.md - 用户希望选择设备或等待设备启动完成——请使用 。
../../devices/connecting-to-devices/SKILL.md - 用户希望了解架构、环境或认证情况——请使用 。
../../architecture/understanding-adb-architecture/SKILL.md
Prerequisites
前置条件
- A connected device with state (see
device).../../devices/connecting-to-devices/SKILL.md - The APK(s) signed with a debug or release key the developer controls.
- For test APKs, the manifest sets (Gradle does this for
android:testOnly="true"builds) and install requiresandroidTest.-t - For runtime permissions, the device runs API 23+.
- 已连接状态为 的设备(参见
device)。../../devices/connecting-to-devices/SKILL.md - APK 已使用开发者掌控的 debug key 或 release key 签名。
- 对于测试 APK,manifest 设置了 (Gradle 会为
android:testOnly="true"build 自动设置),安装时需要使用androidTest。-t - 对于运行时权限,设备需运行 API 23 或更高版本。
Workflow
工作流
-
1. Install with the right flags. From(and the
pm installwrapper) options table:adb installFlag Meaning -r"Reinstall an existing app, keeping its data." Required when the package is already installed; without it returnsadb install. CI scripts MUST always passINSTALL_FAILED_ALREADY_EXISTSfor repeat runs.-r-d"Allow version code downgrade." Required when the new APK has a lower . Note: perversionCode, restricted to debuggable packages on stock builds.adb help-t"Allow test APKs to be installed." Required for any APK whose manifest carries (i.e. all Gradleandroid:testOnly="true"builds).androidTest-g"Grant all permissions listed in the app manifest." Best for hermetic test runs. -lForward-lock the application (legacy DRM). Almost never needed today. -sInstall on the SD card / external storage (when device supports it). --user <id>Install for a specific user profile. Default: all users. resolves to the foreground user.current`--install-location 0 1 -fInstall on internal system memory. -i <installer_pkg>Tag the install with an installer package name. --fastdeployPatch-only install (only changed parts of the APK). /--incremental--no-incrementalStreamed install; requires APK Signature Scheme v4 sidecar ..idsigblocks until full APK is available.--waitCommon recipes:bashadb install -r app-debug.apk # ordinary reinstall adb install -r -d app-debug.apk # allow downgrade adb install -r -t -g app-androidTest.apk # test APK with all permissions granted adb install -r -d --user current app-debug.apk # force foreground-user install -
2. For split APKs use. A modern App Bundle produces a base APK plus per-feature/per-config splits —
adb install-multipleof just one fails:adb installbashadb install-multiple -r -t -g \ base-master.apk base-arm64_v8a.apk base-xxhdpi.apk -
3. Reset app state between tests with. Do NOT use
pm clearfor hermetic isolation.am force-stop- "Force-stop everything associated with
am force-stop <pkg>." — kills processes only. SharedPreferences, Room/SQLite databases, files inpackage, and cache persist./data/data/<pkg> - "Delete all data associated with a package." — wipes user data and cache. The next launch starts from a fresh-install state. For genuine hermetic isolation between tests (the default for instrumented suites), use
pm clear <pkg>.pm clearis appropriate only when the explicit goal is to kill the process while preserving state (e.g. testing a "resume from killed" path).am force-stop
bashadb shell pm clear com.example.appMost pipelines wire this up via Test Orchestrator'sinstrumentation arg — seeclearPackageData.../../tests/running-instrumented-tests-via-adb/SKILL.md -
4. List, find, and inspect packages withand
pm list packages.pm pathpm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [--user <id>] [<filter>]Flag Meaning -f"See associated file." -d"Filter to only show disabled packages." -e"Filter to only show enabled packages." -s"Filter to only show system packages." -3"Filter to only show third-party packages." -i"See the installer for the packages." -u"Include uninstalled packages." --user <id>"The user space to query." Recipes:bashadb shell pm list packages -3 | sort # all sideloaded apps adb shell pm list packages -f com.example # APK paths for matching pkgs adb shell pm path com.example.app # package:/data/app/.../base.apk adb shell dumpsys package com.example.app | head -200 # detailed install/permission info -
5. Manage runtime permissions with/
pm grant(API 23+).pm revoke"Grant a permission to an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest."bashadb shell pm grant com.example.app android.permission.CAMERA adb shell pm revoke com.example.app android.permission.CAMERA adb shell pm reset-permissions # reset every app to defaultsFlaggingat install time grants every manifest-declared runtime permission in one shot — preferred for hermetic test runs.-g -
6. Enable / disable packages or specific components.bash
adb shell pm disable com.example.app # whole package adb shell pm disable-user --user 0 com.example.app # per-user disable (preserves data) adb shell pm enable com.example.app adb shell pm enable com.example.app/.MyTestActivity # specific componentUseful for forcing a known accessibility-service / IME state in tests, or for staging A/B comparisons by disabling rivals. -
7. Uninstall correctly.
pm uninstall [-k] [--user <id>] [--versionCode <vc>] <package>- "Keep the data and cache directories after package removal." Useful for upgrade-from-clean tests where the user data simulates an existing install.
-k - per-user removal.
--user <id> - "Only uninstalls if the app has the given version code." Idempotent uninstall in CI scripts.
--versionCode <vc>
bashadb uninstall com.example.app # equivalent to: pm uninstall <pkg> adb shell pm uninstall -k com.example.app # uninstall but preserve data adb shell pm uninstall --user 0 com.example.app # only from primary user -
8. Dump a Baseline Profile when needed."Starting in Android 7.0 (API level 24), the Android Runtime (ART) collects execution profiles for installed apps...then
adb shell cmd package dump-profiles <package>." The doc warns: "It is only possible to retrieve the execution profile filename if you have root access to the file system, for example, on an emulator." On user builds without root, useadb pull /data/misc/profman/<package>.prof.txtMacrobenchmark to extract the profile programmatically.androidx.benchmark -
9. Diagnose common install failures:
Error Cause Fix INSTALL_FAILED_VERSION_DOWNGRADENew APK's is lower than the installed one.versionCodeAdd .-dINSTALL_FAILED_USER_RESTRICTEDMulti-user device: the install user (typically the secondary or work profile) blocks installs. or--user 0; have the user disable "Install via USB" restriction in their profile.--user current(signature mismatch)INSTALL_FAILED_UPDATE_INCOMPATIBLENew APK signed with a different key than the installed one. Uninstall first ( ); resign with the same key.adb uninstall <pkg>INSTALL_FAILED_TEST_ONLYAPK has butandroid:testOnly="true"was omitted.-tAdd (typical for-t).app-androidTest.apk(split APK only)INSTALL_FAILED_INVALID_APKTried to install one APK of a split set. Use .adb install-multipleINSTALL_FAILED_INSUFFICIENT_STORAGEOut of space. and cleanup.adb shell df /data -
10. Quote the shell correctly (Platform Tools 23+ rule). Verbatim from the adb page:"With Android Platform Tools 23 and higher,handles arguments the same way that the
adbcommand does. ...ssh(1)is now an error ... To make the command work, quote twice, once for the local shell and once for the remote shell, as you do withadb shell setprop key 'two words'. For example,ssh(1)works because the local shell takes the outer level of quoting and the device still sees the inner level of quoting." Same rule applies for anyadb shell setprop key \"'two words'\"argument with spaces, special characters, or shell metacharacters.pm
-
1. 使用正确的标志安装。 以下选项摘自(以及
pm install包装器)的选项表:adb install标志 含义 -r“重新安装现有应用并保留数据。” 当包已安装时必须使用;否则 会返回adb install。CI 脚本重复运行时必须始终传入INSTALL_FAILED_ALREADY_EXISTS。-r-d“允许 versionCode 降级。” 当新 APK 的 更低时必须使用。注意:根据versionCode,在标准系统构建中,此选项仅限 debuggable 包使用。adb help-t“允许安装测试 APK。” 任何 manifest 中包含 的 APK(即所有 Gradleandroid:testOnly="true"build)都必须使用此选项。androidTest-g“授予应用 manifest 中列出的所有权限。” 最适合 hermetic 测试运行。 -l对应用启用 forward lock(旧版 DRM)。如今几乎不需要使用。 -s安装到 SD 卡或外部存储(设备支持时)。 --user <id>为特定用户配置文件安装。默认值为:所有用户。 表示当前前台用户。current`--install-location 0 1 -f安装到内部系统存储。 -i <installer_pkg>使用 installer package name 标记本次安装。 --fastdeploy仅安装发生变化的 APK 部分。 /--incremental--no-incremental流式安装;需要 APK Signature Scheme v4 sidecar 。.idsig会阻塞,直到完整 APK 可用。--wait常用示例:bashadb install -r app-debug.apk # ordinary reinstall adb install -r -d app-debug.apk # allow downgrade adb install -r -t -g app-androidTest.apk # test APK with all permissions granted adb install -r -d --user current app-debug.apk # force foreground-user install -
2. 对于 split APK,使用。 现代 App Bundle 会生成一个 base APK,以及按功能或配置拆分的 split APK——仅使用
adb install-multiple安装其中一个会失败:adb installbashadb install-multiple -r -t -g \ base-master.apk base-arm64_v8a.apk base-xxhdpi.apk -
3. 使用在测试之间重置应用状态。不要将
pm clear用于 hermetic isolation。am force-stop- :“强制停止与
am force-stop <pkg>关联的所有内容。”——它只会终止进程。SharedPreferences、Room/SQLite 数据库、package中的文件以及缓存都会继续保留。/data/data/<pkg> - :“删除与包关联的所有数据。”——它会清除用户数据和缓存。下次启动时,应用将处于全新安装状态。 若要在测试之间实现真正的 hermetic isolation(instrumented 测试套件的默认要求),请使用
pm clear <pkg>。只有在明确目标是在保留状态的同时终止进程时,才适合使用pm clear,例如测试“从被终止状态恢复”的路径。am force-stop
bashadb shell pm clear com.example.app大多数 pipeline 会通过 Test Orchestrator 的instrumentation arg 完成此操作——参见clearPackageData。../../tests/running-instrumented-tests-via-adb/SKILL.md -
4. 使用和
pm list packages列出、查找和检查包。pm pathpm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [--user <id>] [<filter>]标志 含义 -f“查看关联文件。” -d“仅显示已禁用的包。” -e“仅显示已启用的包。” -s“仅显示系统包。” -3“仅显示第三方包。” -i“查看这些包的 installer。” -u“包含已卸载的包。” --user <id>“要查询的用户空间。” 常用示例:bashadb shell pm list packages -3 | sort # all sideloaded apps adb shell pm list packages -f com.example # APK paths for matching pkgs adb shell pm path com.example.app # package:/data/app/.../base.apk adb shell dumpsys package com.example.app | head -200 # detailed install/permission info -
5. 使用/
pm grant管理运行时权限(API 23+)。pm revoke“向应用授予权限。在运行 Android 6.0(API level 23)或更高版本的设备上,该权限可以是应用 manifest 中声明的任何权限。”bashadb shell pm grant com.example.app android.permission.CAMERA adb shell pm revoke com.example.app android.permission.CAMERA adb shell pm reset-permissions # reset every app to defaults在安装时指定,可以一次性授予 manifest 中声明的所有运行时权限——这是 hermetic 测试运行的首选方式。-g -
6. 启用或禁用包及特定组件。bash
adb shell pm disable com.example.app # whole package adb shell pm disable-user --user 0 com.example.app # per-user disable (preserves data) adb shell pm enable com.example.app adb shell pm enable com.example.app/.MyTestActivity # specific component这有助于在测试中强制应用处于已知的 accessibility service 或 IME 状态,或者通过禁用竞品应用来准备 A/B 对比环境。 -
7. 正确卸载。
pm uninstall [-k] [--user <id>] [--versionCode <vc>] <package>- :“移除包后保留数据和缓存目录。”适用于从干净状态升级的测试,其中用户数据用于模拟已有安装。
-k - :按用户卸载。
--user <id> - :“仅当应用具有指定的 version code 时才卸载。”可在 CI 脚本中实现幂等卸载。
--versionCode <vc>
bashadb uninstall com.example.app # equivalent to: pm uninstall <pkg> adb shell pm uninstall -k com.example.app # uninstall but preserve data adb shell pm uninstall --user 0 com.example.app # only from primary user -
8. 根据需要转储 Baseline Profile。“从 Android 7.0(API level 24)开始,Android Runtime (ART) 会为已安装的应用收集 execution profiles……执行,然后执行
adb shell cmd package dump-profiles <package>。” 文档警告:“只有在拥有文件系统 root 访问权限时,才能获取 execution profile 文件名,例如在模拟器上。”在无 root 权限的用户版系统上,可使用adb pull /data/misc/profman/<package>.prof.txtMacrobenchmark 以编程方式提取 profile。androidx.benchmark -
9. 诊断常见安装失败:
错误 原因 修复方法 INSTALL_FAILED_VERSION_DOWNGRADE新 APK 的 低于已安装版本。versionCode添加 。-dINSTALL_FAILED_USER_RESTRICTED多用户设备:安装目标用户(通常是辅助用户或工作资料)阻止了安装。 使用 或--user 0;让用户在其用户配置中禁用“通过 USB 安装”限制。--user current(签名不匹配)INSTALL_FAILED_UPDATE_INCOMPATIBLE新 APK 使用的签名 key 与已安装版本不同。 先卸载( );然后使用相同的 key 重新签名。adb uninstall <pkg>INSTALL_FAILED_TEST_ONLYAPK 包含 ,但未指定android:testOnly="true"。-t添加 (常见于-t)。app-androidTest.apk(仅限 split APK)INSTALL_FAILED_INVALID_APK尝试安装 split APK 集合中的单个 APK。 使用 。adb install-multipleINSTALL_FAILED_INSUFFICIENT_STORAGE存储空间不足。 执行 并清理空间。adb shell df /data -
10. 正确处理 shell 引用(Platform Tools 23+ 规则)。 以下内容摘自 adb 页面:“在 Android Platform Tools 23 及更高版本中,处理参数的方式与
adb命令相同。...ssh(1)现在会报错 ... 若要让命令正常工作,需要进行两次引用,一次用于本地 shell,一次用于远程 shell,就像使用adb shell setprop key 'two words'时一样。例如,ssh(1)可以正常工作,因为本地 shell 会处理外层引用,而设备仍会看到内层引用。” 对于任何包含空格、特殊字符或 shell 元字符的adb shell setprop key \"'two words'\"参数,也适用相同规则。pm
Patterns
模式
Pattern: WRONG vs RIGHT — resetting app state between tests
模式:错误与正确——在测试之间重置应用状态
bash
undefinedbash
undefinedWRONG
WRONG
adb shell am force-stop com.example.app
adb shell am force-stop com.example.app
Run next test...
Run next test...
WRONG because: force-stop kills the process but leaves SharedPreferences,
WRONG because: force-stop kills the process but leaves SharedPreferences,
Room DB, files in /data/data/<pkg>, and cache. Tests that read any of those
Room DB, files in /data/data/<pkg>, and cache. Tests that read any of those
carry stale state into the next case. Flake follows.
carry stale state into the next case. Flake follows.
```bash
```bashRIGHT
RIGHT
adb shell pm clear com.example.app
adb shell pm clear com.example.app
Run next test against fresh-install state.
Run next test against fresh-install state.
For test runs, the equivalent done by the runner itself is `-e clearPackageData true` to AndroidX Test Orchestrator — see `../../tests/running-instrumented-tests-via-adb/SKILL.md`.
对于测试运行,runner 自身执行的等效操作是向 AndroidX Test Orchestrator 传入 `-e clearPackageData true`——参见 `../../tests/running-instrumented-tests-via-adb/SKILL.md`。Pattern: WRONG vs RIGHT — installing an androidTest
APK
androidTest模式:错误与正确——安装 androidTest
APK
androidTestbash
undefinedbash
undefinedWRONG
WRONG
adb install app-androidTest.apk
adb install app-androidTest.apk
adb: failed to install app-androidTest.apk: Failure [INSTALL_FAILED_TEST_ONLY:
adb: failed to install app-androidTest.apk: Failure [INSTALL_FAILED_TEST_ONLY:
installPackageLI]
installPackageLI]
WRONG because: any APK with android:testOnly="true" (every Gradle-built test
WRONG because: any APK with android:testOnly="true" (every Gradle-built test
APK) requires -t
.
-tAPK) requires -t
.
-t
```bash
```bashRIGHT
RIGHT
adb install -r -t -g app-androidTest.apk
adb install -r -t -g app-androidTest.apk
-r: reinstall keeping data (or overwriting); -t: allow test packages;
-r: reinstall keeping data (or overwriting); -t: allow test packages;
-g: grant all runtime permissions for hermetic tests.
-g: grant all runtime permissions for hermetic tests.
undefinedundefinedPattern: WRONG vs RIGHT — version downgrade after a debug install
模式:错误与正确——debug 安装后发生版本降级
bash
undefinedbash
undefinedWRONG
WRONG
adb install -r app-release.apk
adb install -r app-release.apk
adb: failed to install app-release.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
adb: failed to install app-release.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
WRONG because: the installed debug APK has a higher versionCode than the
WRONG because: the installed debug APK has a higher versionCode than the
release APK being installed.
release APK being installed.
```bash
```bashRIGHT
RIGHT
adb install -r -d app-release.apk # allow downgrade
adb install -r -d app-release.apk # allow downgrade
Or, when signature also changes:
Or, when signature also changes:
adb uninstall com.example.app
adb install app-release.apk
undefinedadb uninstall com.example.app
adb install app-release.apk
undefinedPattern: WRONG vs RIGHT — listing only third-party packages
模式:错误与正确——仅列出第三方包
bash
undefinedbash
undefinedWRONG
WRONG
adb shell pm list packages | grep -v 'com.android'
adb shell pm list packages | grep -v 'com.android'
WRONG because: many third-party packages also have names containing
WRONG because: many third-party packages also have names containing
"com.android" (e.g. third-party Android library demos), and Google's own
"com.android" (e.g. third-party Android library demos), and Google's own
pre-installed apps carry varied prefixes (com.google.android.*).
pre-installed apps carry varied prefixes (com.google.android.*).
```bash
```bashRIGHT
RIGHT
adb shell pm list packages -3
adb shell pm list packages -3
-3
filters to third-party (non-system) packages only.
-3-3
filters to third-party (non-system) packages only.
-3undefinedundefinedMandatory rules
强制规则
- MUST use to reset app state between tests;
pm clear <pkg>does NOT clear data.am force-stop - MUST add when installing any test APK (
-t); addandroid:testOnly="true"when downgrading; add-dto grant all manifest runtime permissions.-g - MUST use for split APKs (App Bundles). Single-APK install of one split fails with
adb install-multiple.INSTALL_FAILED_INVALID_APK - MUST NOT assume of a freshly built debug APK will replace a release-signed install — signing-conflict errors require uninstall first.
adb install - MUST NOT rely on heuristics; use the documented filters (
pm list packages | grep,-3,-s,-d,-e).-u - PREFERRED: wire through Test Orchestrator (
clearPackageData true) instead of running../../tests/running-instrumented-tests-via-adb/SKILL.mdmanually before every test.pm clear - PREFERRED: quote string arguments twice when they contain spaces or shell metacharacters — Platform Tools 23+ requires this (ssh-style quoting).
- 必须使用 在测试之间重置应用状态;
pm clear <pkg>不会清除数据。am force-stop - 必须在安装任何测试 APK()时添加
android:testOnly="true";降级时添加-t;添加-d以授予所有 manifest 运行时权限。-g - 必须使用 安装 split APK(App Bundle)。仅安装其中一个 split 会因
adb install-multiple而失败。INSTALL_FAILED_INVALID_APK - 不得假设 新构建的 debug APK 会覆盖使用 release key 签名的安装版本——签名冲突错误需要先卸载。
adb install - 不得依赖 启发式方法;应使用已文档化的过滤器(
pm list packages | grep、-3、-s、-d、-e)。-u - **首选:**通过 Test Orchestrator 配置 (
clearPackageData true),而不是在每次测试前手动运行../../tests/running-instrumented-tests-via-adb/SKILL.md。pm clear - **首选:**当字符串参数包含空格或 shell 元字符时进行两次引用——Platform Tools 23+ 要求采用此方式(ssh 风格引用)。
Verification
验证
- returns
adb install -r -t -g app-androidTest.apk.Success - prints a
adb shell pm path com.example.appline for the just-installed package.package:/data/app/...base.apk - returns
adb shell pm clear com.example.app, andSuccessshows only freshly createdadb shell run-as com.example.app ls /data/data/com.example.appandcache/entries.code_cache/ - lists the package after install.
adb shell pm list packages -3 | grep com.example.app - After ,
adb shell pm grant com.example.app android.permission.CAMERAshows the permission as granted.adb shell dumpsys package com.example.app | grep CAMERA - returns
adb uninstall com.example.appandSuccessno longer shows the app.pm list packages com.example - CI run wipes app state between tests via Orchestrator () or an explicit
-e clearPackageData truestep inpm clear/@Before.@After
- 返回
adb install -r -t -g app-androidTest.apk。Success - 为刚安装的包输出一行
adb shell pm path com.example.app。package:/data/app/...base.apk - 返回
adb shell pm clear com.example.app,且Success仅显示新创建的adb shell run-as com.example.app ls /data/data/com.example.app和cache/条目。code_cache/ - 安装后,会列出该包。
adb shell pm list packages -3 | grep com.example.app - 执行 后,
adb shell pm grant com.example.app android.permission.CAMERA会显示该权限已授予。adb shell dumpsys package com.example.app | grep CAMERA - 返回
adb uninstall com.example.app,并且Success不再显示该应用。pm list packages com.example - CI 运行通过 Orchestrator()或
-e clearPackageData true/@Before中显式的@After步骤,在测试之间清除应用状态。pm clear
References
参考资料
- ADB user guide (,
pm install,pm uninstall,pm clear,pm grant): https://developer.android.com/tools/adb#pmpm list packages - AGP/Studio command-line testing (and orchestrator wiring): https://developer.android.com/studio/test/command-line
am instrument - Baseline Profile dump via : https://developer.android.com/topic/performance/baselineprofiles
cmd package dump-profiles - App Bundle / split APK install: https://developer.android.com/studio/build/build-variants
- — verbatim
tasks/research/A2-adb-shell-commands.md/pm install/pm listflag tables,pm clearvsforce-stopdistinction, ssh-style double-shell quoting since Platform Tools 23.pm clear - §I.10 — "force-stop does NOT clear data — pair with
docs/CORPUS.mdfor hermetic reset."pm clear - Sibling skills:
- High-level architecture:
../../architecture/understanding-adb-architecture/SKILL.md - Connect a device:
../../devices/connecting-to-devices/SKILL.md - Wireless ADB:
../../devices/connecting-over-wifi/SKILL.md - Run tests via (and Orchestrator
am instrument):clearPackageData../../tests/running-instrumented-tests-via-adb/SKILL.md
- High-level architecture:
- Cross-set neighbours:
- Run instrumented tests with :
AndroidJUnit4../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md - Configure JUnit4 on Android:
../../../jvm-tests/runner/configuring-junit4-on-android/SKILL.md - Source-set strategy:
../../../fundamentals/strategies/organizing-test-source-sets/SKILL.md
- Run instrumented tests with
- ADB 用户指南(、
pm install、pm uninstall、pm clear、pm grant):https://developer.android.com/tools/adb#pmpm list packages - AGP/Studio 命令行测试(与 Orchestrator 配置):https://developer.android.com/studio/test/command-line
am instrument - 通过 转储 Baseline Profile:https://developer.android.com/topic/performance/baselineprofiles
cmd package dump-profiles - App Bundle / split APK 安装:https://developer.android.com/studio/build/build-variants
- ——逐字记录
tasks/research/A2-adb-shell-commands.md/pm install/pm list标志表、pm clear与force-stop的区别,以及 Platform Tools 23 起的 ssh 风格双层 shell 引用。pm clear - §I.10——“force-stop 不会清除数据——应与
docs/CORPUS.md配合使用以实现 hermetic reset。”pm clear - 同级 skill:
- 高层架构:
../../architecture/understanding-adb-architecture/SKILL.md - 连接设备:
../../devices/connecting-to-devices/SKILL.md - 无线 ADB:
../../devices/connecting-over-wifi/SKILL.md - 通过 运行测试(以及 Orchestrator
am instrument):clearPackageData../../tests/running-instrumented-tests-via-adb/SKILL.md
- 高层架构:
- 跨集合关联项:
- 使用 运行插桩测试:
AndroidJUnit4../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md - 配置 Android 上的 JUnit4:
../../../jvm-tests/runner/configuring-junit4-on-android/SKILL.md - Source-set 策略:
../../../fundamentals/strategies/organizing-test-source-sets/SKILL.md
- 使用