安装卸载app
adb install -r <app name.apk> [The -r option allows you to re-install or update an existing app on your device]
adb install -s <app name.apk> [The -s option lets you install app to SD card if the app supports move to SD card feature]
adb uninstall <app name.apk>
adb shell pm uninstall --user 0 com.tencent.mtt
查看app的permission
To see only permissions that were granted (but omitting ones that were requested but not granted) use
adb shell dumpsys package packagename
To list all permissions (requested but not granted + requested and granted):
Notice the APK of a package. You can run the same command
adb shell dumpsys package packagename
List all permissions of the package
If missing from device/emulator aapt can be found under build-tools/<version>/in your Android SDK.
Then execute
aapt d permissions /path/to/com.your.package.apk
列出安装的app
adb shell cmd package list packages
This will return a list of the package names of the apps installed on the device. Each line is prefixed by package:.
There are even some options you can use:
list packages [-f] [-d] [-e] [-s] [-3] [-i] [-l] [-u] [-U] [--uid UID] [--user USER_ID] [FILTER]
Prints all packages; optionally only those whose name contains
the text in FILTER.
Options:
-f: see their 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
-l: ignored (used for compatibility with older releases)
-U: also show the package UID
-u: also include uninstalled packages
--uid UID: filter to only show packages with the given UID
--user USER_ID: only list packages belonging to the given user
An alternative for older Android versions is
adb shell pm list packages
but this is deprecated and will likely be removed in the future.
adb shell cmd package list packages > appAll.txt
adb shell cmd package list packages -s > appSys.txt
adb shell cmd package list packages -3 > app3party.txt
adb shell cmd package list packages -e > appEnabled.txt
adb shell cmd package list packages -d > appDisabled.txt
启动app
adb shell
am start -n com.package.name/com.package.name.ActivityName
Or you can use this directly:
adb shell am start -n com.package.name/com.package.name.ActivityName
You can also specify actions to be filter by your intent-filters:
am start -a com.example.ACTION_NAME -n com.package.name/com.package.name.ActivityName
You can find out the activity names by running
aapt dump xmltree <APK> AndroidManifest.xml
and looking through the output.
You can find the apk on the phone with
adb shell pm list packages -f
and retrieve it with
adb pull /path/to/file.apk C:\some\folder
to use with the aapt command . (aapt is in build-tools)
eg:
MyPackageName is com.example.demo
MyActivityName is com.example.test.MainActivity
adb shell am start -n com.example.demo/com.example.test.MainActivity
You don't need root to pull the apk files from /data/app.
Sure, you might not have permissions to list the contents of that directory, but you can find the file locations of APKs with:
adb shell pm list packages -f
Then you can use adb pull:
adb pull <APK path from previous command>
and then aapt to get the information you want:
aapt dump badging <pulledfile.apk>
app权限
You're executing the following:
abd shell pm [grant|revoke] com.my.app android.permission.ACCESS_FINE_LOCATION
It should be adb, for Android Debug Bridge. i.e.
adb shell pm [grant|revoke] com.my.app android.permission.ACCESS_FINE_LOCATION