简体   繁体   English

Gradle,向adb发送命令

[英]Gradle, sending command to adb

I need that every time before running the tests, run the task with the command for adb 在运行测试之前,我每次都需要它,使用adb命令运行任务

adb shell pm reset-permissions

I tried doing this in my gradle file, it`s compilling, but how does it run? 我尝试在我的gradle文件中执行此操作,这是令人满意的,但它是如何运行的?

buildscript {
...
}

android {
...
}

task resetPermission(type: Exec) {
    commandLine 'adb', 'shell', 'pm', 'reset-permissions'
}

You'll need to edit your test running configurations, to add the task. 您需要编辑测试运行配置,以添加任务。

See my (similar) answer here : https://stackoverflow.com/a/35157119/4706693 请参阅我的(类似)答案: https//stackoverflow.com/a/35157119/4706693

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM