Last active
February 29, 2016 10:27
-
-
Save up1/9a26521e31f246afb849 to your computer and use it in GitHub Desktop.
Espresso with Android M
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task grantPermissions(type: Exec, dependsOn: 'installDevDebug') { | |
| def adb = android.getAdbExe().toString() | |
| commandLine "sh grant_permissions.sh $adb demo.up1.dev".split(" ") | |
| } | |
| afterEvaluate { | |
| tasks.each { task -> | |
| if (task.name.startsWith('connectedDevDebugAndroidTest')) { | |
| task.dependsOn grantPermissions | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # argument: apk adb package | |
| # ex: sh grant_permissions.sh <path_to_adb> <package> | |
| adb=$1 | |
| package=$2 | |
| if [ "$#" = 0 ]; then | |
| echo "No parameters found, run with sh grant_permissions.sh <path_to_adb> <package>" | |
| exit 0 | |
| fi | |
| # get all the devices | |
| devices=$($adb devices | grep -v 'List of devices' | cut -f1 | grep '.') | |
| for device in $devices; do | |
| echo "Setting permissions to device" $device "for package" $package | |
| $adb -s $device shell pm grant $package android.permission.READ_PHONE_STATE | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment