Android Plugin DSL Reference 参考文档 :
AdbOptions ( build.gradle#android#adbOptions 配置 ) 文档位置 : https://google.github.io/android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.AdbOptions.html
AdbOptions#installOptions 配置 表示 APK 安装时的可选参数 ;
该配置类型是 Collection<String>
, 是一个字符串集合 , 传入若干字符串参数 , 参数之间使用 逗号 隔开 ;
AdbOptions#installOptions 配置原型如下 :
Collection<String> installOptions
The list of APK installation options.
在 Android Studio 的 Terminal 面板中 , 执行
adb
命令 , 如果不传入文件路径参数 , 会打印出提示信息 , 提示信息中有安装参数 , 就是 AdbOptions#installOptions 配置可以设置的参数 ;
执行 adb 命令 , 输出了很多内容 , 这里只关心 adb install 相关的参数 ,
app installation (see also `adb shell cmd package help`):
install [-lrtsdg] [--instant] PACKAGE
push a single package to the device and install it
install-multiple [-lrtsdpg] [--instant] PACKAGE...
push multiple APKs to the device for a single package and install them
install-multi-package [-lrtsdpg] [--instant] PACKAGE...
push one or more packages to the device and install them atomically
-r: replace existing application
-t: allow test packages
-d: allow version code downgrade (debuggable packages only)
-p: partial application install (install-multiple only)
-g: grant all runtime permissions
--abi ABI: override platform's default ABI
--instant: cause the app to be installed as an ephemeral install app
--no-streaming: always push APK to device and invoke Package Manager as separate steps
--streaming: force streaming APK directly into Package Manager
--fastdeploy: use fast deploy
--no-fastdeploy: prevent use of fast deploy
--force-agent: force update of deployment agent when using fast deploy
--date-check-agent: update deployment agent when local version is newer and using fast deploy
--version-check-agent: update deployment agent when local version has different version code and using fast deploy
(See also `adb shell pm help` for more options.)
uninstall [-k] PACKAGE
remove this app package from the device
'-k': keep the data and cache directories
-r 参数 表示替换当前的应用 ;
-r: replace existing application
-d 参数 表示允许安装比当前版本低的应用 ;
只有可调式包才支持该选项 ;
-d: allow version code downgrade (debuggable packages only)
-g 参数 表示 赋予该应用所有的运行时权限 ;
-g: grant all runtime permissions
AdbOptions ( build.gradle#android#adbOptions 配置 ) 文档位置 : https://google.github.io/android-gradle-dsl/2.3/com.android.build.gradle.internal.dsl.AdbOptions.html
AdbOptions#timeOutInMs 配置 表示 执行 adb 命令时的超时等待时间 , 单位 毫秒 ms ;
AdbOptions#timeOutInMs 配置原型 :
int timeOutInMs
The time out used for all adb operations.