When testing Android , We need to take apk To the Andro , Capture the request , At the same time monitor the application log . This article will talk about the specific operation .
Android is an Android based machine , Such as mobile phone 、POS machine 、 TV boxes, etc .
We refuse to use U Disk file . Direct use WIFI Pass on . Don't ask , To ask is to pretend to force . Ha ha ha .
① First of all, put the installation into the artifact adb download , Open the following website ：
Download and get UniversalAdbDriverSetup.msi file , Only 16.2 M, Compared with some people, let's install Android Studio, It's too light .
② Open after installation cmd, Input
As shown in the figure, even if the installation is successful .
③ And then keep pretending , Take out the Andro , Open Settings | System | About mobile phone , Facing “ Version number ” A jab , Poke to developer mode , Enable it （ Different Android machines may have different ways ）.
④ loading , Get dressed . stay WIFI Setting up , Find the one that is already on the same network as the computer WIFI, See advanced options , obtain IP Address .
⑤ At the computer cmd in , Enter the following command to use adb Connect the Android ：
adb connect 192.168.x.x
As shown in the figure, even if the connection is successful ：
⑥ good , Everything is ready. , Start the operation , The computer → mobile phone ：
adb push D:\test.apk /storage/emulated/0/
The computer ← mobile phone ：
adb pull /storage/emulated/0/test.apk D:\
Grab the bag
The tools used in bag capturing are Charles. Download address ：
Download and install directly . Suggest to find a crack , Otherwise, it will be a little bit stuck .
It's easy to grab a bag , It only takes two steps . The first step is to start the agent on the computer . The second step is to manually set up the agent on the Android machine .
The first step is to start the agent on the computer .Charles Open in Proxy | Proxy Settings Enable agent , Default port 8888：
The second step is to manually set up the agent on the Android machine . Turn on the Android WIFI Set up , Edit the web （ Different mobile phones may have different ways ）, Add manual agent , Fill in The computer IP and Charles The proxy port ：
After the save Charles There will be a connection request ：
Permission is enough .
Computer terminal cmd One line of command ：
However, there will be more logs to be typed in this way . You can do some filtering .
adb logcat | find "some"
adb locat | grep "some"
The problem of not catching the bag
It's possible that you won't catch the bag . Different machines have different reasons . I can't give the perfect solution here . I can only share my experience . If it can't be solved , Or find Baidu .
One possibility is HTTPS Certificate problem , stay Help | SSL Proxying There are corresponding functions ：
Sometimes it's OK to install the certificate on the computer , Sometimes you need to download the certificate on your Android ：
Once I visited this link and there was no response , restart Charles It's ready to download again .
Another possibility is that no white list has been added ,Proxy | SSL Proxying setttings：
A brief review
This paper introduces the preparation of Android test environment , Yes adb、Charles Software , File transfer 、 Grab the bag 、 Log . The operation is relatively simple , But in practice , There may be strange problems due to different machines . Through Baidu , Generally, it can be solved . Finally, warm tips , If the next day the Android machine says it can't connect to the network , So let's see if it's a computer Charles It's off . Ha ha ha .