Android and iOS common operations command

Related applications

1, the setup application (real machine)

Android

adb install xxx.apk

iOS

ideviceinstaller -i xxx.ipa

2, uninstall the application (real machine)

Android

adb uninstall <packageName>

iOS

ideviceinstaller -U <bundleId>

3 immediate access to unique identification

In fact, it is not too uniquely identifies, but most of the operations will be used.

Android: packageName
get a lot of ways, just give one relatively easy:

$ apktool d xxx.apk -o xxx
$ cd xxx
$ cat AndroidManifest.xml | grep -o "package=\".*\"" | sed "s/package=\"//g" | sed "s/\"//g"
com.test

iOS:bundleId

$ unzip xxx.ipa
$ cd Payload/xxx.app
$ defaults read `pwd`/Info CFBundleIdentifier
com.test

4, the installation package building applications from source

Here only cite debug package

android (android studio project now has been very popular, so I will not say the ant)

$ cd /source-folder/
# 注意:没***情况下貌似不能自动下载 gradle ,那么可以自行下载 gradle 后用 gradle bin 文件代替此处的 gradlew
$ ./gradlew build
# build 完的 apk 包放在 Application/build/outputs/apk

iOS real machine

$ cd /source-folder/
$ PROJECT=<your-project-name>
$ xcodebuild clean -project $PROJECT.xcodeproj -configuration Debug -alltargets
$ xcodebuild archive -project $PROJECT.xcodeproj -scheme $PROJECT -archivePath $PROJECT.xcarchive
# 注意,末尾的 exportProvisioningProfile 参数值是在 Xcode Performance->Accounts->Apple ID->View Details 窗口的下半部分看到的名称。如 iOS Team Provisioning Profile: chj.ToDoList
$ xcodebuild -exportArchive -archivePath $PROJECT.xcarchive -exportPath $PROJECT -exportFormat ipa -exportProvisioningProfile "your provision profile"
# build 完的 ipa 包直接就放在当前目录

Related equipment

1 application list, view the device

Android

$ adb shell pm list packages
package:com.miui.gallery
package:com.xiaomi.tv.gallerylockscreen
...

If there  drozer  then can be displayed more clearly

dz> run app.package.list
com.miui.gallery (图库)
com.xiaomi.tv.gallerylockscreen (锁屏画报)
...

iOS

$ ideviceinstaller [-u <device-udid>] -l
Total: 46 apps
com.xiaojukeji.didi - 滴滴出行 4.1.5.0
com.tencent.mqq - QQ 6.0.0.424
...

2, get real-time log real machine

Android

adb [-s <device-name>] logcat

iOS

idevicesyslog [-u <device-udid>]

3, get a list of currently connected devices

Android

$ adb devices

iOS

# 注意:这里列出的设备包括模拟器及 mac 电脑本身
$ instruments -s devices

Supplementary:
mac install the following:

brew install usbmuxd
brew install ideviceinstaller

You can get ios phone udid

idevice_id -l

Guess you like

Origin www.cnblogs.com/kaola8023/p/12051071.html