分享我在 2022 年開發Android App中最常用的指令
Preview
-
when I am developing that I always used
brewto install some cli tool.- install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Android
-
How to install test
aabfile-
install bundletool
brew install bundletool -
switch to your aab file folder and convert it to apk file
bundletool build-apks --bundle=./app.aab --output=./app.apks -
install apk
bundletool install-apks --apks=app.apks
-
-
Adbtool that I often used- Clear app data
adb shell pm clear your.package.name- Delete app
adb uninstall your.package.name- Search app package
adb shell pm list packages | grep 'keyword'- Disable app
adb shell pm disable-user 'your.package.name'- Open app
adb shell am start -n your.package.name- Open app and goto assign page
adb shell am start -n your.package.name/your.assign.activity.path- Forec-stop apps
adb shell am force-stop your.package.name- Open Accessibility page
adb shell am start -a android.settings.ACCESSIBILITY_SETTINGS- Open Device admin page
adb shell am start -n android.app.extra.DEVICE_ADMIN- Set device owner
adb -d shell dpm set-device-owner your.package.name/.your.admin.receivers.path- Remove device owner
adb shell dpm remove-active-admin your.package.name/.your.admin.receivers.path- Dumpsys device owner info
adb shell dumpsys device_policy- Grant app permissions
adb shell "pm grant your.package.name android.permission.YourPermission && am force-stop elegant.access.aidltest"- Pull files
adb pull /your/path-
Switch tcpip port
adb tcpip <port> -
Catch android log
bootloader
- The step of recovery Android phone use the office OTA
- Update bootloader
`fastboot flash bootloader bootloader-bullhead-xxxVersion.img`
- Reboot bootloader
`fastboot reboot-bootloader`
- Update radio
`fastboot flash radio radio-bullhead-xxxx-x.x.xx.x.xx.img`
- Reboot bootloader
`fastboot reboot-bootloader`
- Flash system
`fastboot flash system system.img`
- Flash vendor
`fastboot flash vendor vendor.img`
- Flash user data (This step will clear your internal storage.)
`fastboot flash userdata userdata.img`
- Flash boot
`fastboot flash boot boot.img`
- Flash recovery
`fastboot flash recovery recovery.img`
- Clear cache
`fastboot erase cache`
- Flash cache
`fastboot flash cache cache.img`
- Reboot android OS
`fastboot reboot`
- This office website can find the office OTA .
Git
I like to use git command line to control my repo instead of git GUI tool.
- Let your git graph not merge together and not commit after you sent the cli.
git merge --no-ff --no-commit hash
- Edit your commit
`git commit --amend`
- Rebase and sync your local repo with remote
`git pull origin --rebase`
- Story/Recovery/Show your not finish work
git stash --include-untracked 、 git stash pop、 git list
- See your local git info
`git config -l`
- Base git concept
`git add , git commit , git push , git checkout, git pull , git cherry-pick, git branch , git remote...etc.`
Others
- See Java environment
/usr/libexec/java_home -V