-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.32.functions
81 lines (66 loc) · 2.25 KB
/
build.32.functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#==================== put your favorites functions there ===============================
function run_apk
{
APK_FILE=$1
if [ -f $APK_FILE ]
then
aapt=$(find $ANDROID_SDK_ROOT/build-tools/|grep aapt$|sort|tail -n1)
pkg=$($aapt dump badging "$APK_FILE"|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}')
act=$($aapt dump badging "$APK_FILE"|awk -F" " '/launchable-activity/ {print $2}'|awk -F"'" '/name=/ {print $2}')
echo "Running $pkg/$act"
$ADB shell am start -n "$pkg/$act"
echo "press <enter> to kill app"
read
echo "$ADB shell am force-stop $APK"
$ADB shell am force-stop $APK
fi
}
function install_run
{
APK_FILE=$1
if [ -f $APK_FILE ]
then
echo " * installing $APK_FILE"
$ADB install $APK_FILE
aapt=$(find $ANDROID_SDK_ROOT/build-tools/|grep aapt$|sort|tail -n1)
pkg=$($aapt dump badging "$APK_FILE"|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}')
act=$($aapt dump badging "$APK_FILE"|awk -F" " '/launchable-activity/ {print $2}'|awk -F"'" '/name=/ {print $2}')
echo "Running $pkg/$act"
$ADB shell am start -n "$pkg/$act"
echo "press <enter> to kill app"
read
echo "$ADB shell am force-stop $APK"
$ADB shell am force-stop $APK
fi
}
if echo $(which adb)|grep -q /usr/bin
then
export PATH=$ANDROID_SDK_ROOT/platform-tools:$PATH
echo using sdk adb from $(which adb)
fi
export ADB="$ANDROID_SDK_ROOT/platform-tools/adb"
if $ANDROID_SDK_ROOT/platform-tools/adb devices -l|grep -q $ADB_HOST 2>/dev/null
then
export ADB="$ANDROID_SDK_ROOT/platform-tools/adb -s $ADB_HOST"
echo "
Device = $ADB_HOST
"
else
if $ADB devices -l 2>/dev/null|grep -v ^L|grep -c -v ^$ |grep -q 0
then
echo No connected android device found
if echo $ADB_NET | grep -q 192
then
echo "Trying to connect $ADB_NET via network"
$ADB disconnect $ADB_NET
$ADB connect $ADB_NET
export ADB="$ANDROID_SDK_ROOT/platform-tools/adb -s $ADB_NET"
else
echo "No USB device found"
fi
fi
fi
export PS1="[PYDK($BITS)]$PS1"
env |grep PDK_
cd $SDK/build.${BITS}