As smartphones grow, the number of devices installed on the smart platform (Android, iOS) is also increasing rapidly. It brings great business opportunities to developers. Developers pay more attention to the android platform, which means that the support department must deal more with the system. technicians must migrate their existing experience to the new platform. In the traditional PCweb, network-related problems have been compared with the growth of smartphones, and the number of smart platforms (Andorid, iOS) is also increasing rapidly. It brings great business opportunities to developers.
Developers pay more attention to the android platform, which means that the support department must deal more with the system. technicians must migrate their existing experience to the new platform. In the traditional PCweb, network-related problems have been well-developed methods and procedures for locating and tracking, and software on mobile devices need to be integrated and optimized.
If you have encountered a problem reported by developers recently, you need to determine whether network communication is normal when the problem occurs. For this purpose, two schemes are designed for testing and debugging and analysis of network conditions by using the simulator and the actual device with the network tool.
Solution 1 use the simulator included in the Android SDK for debuggingPrepare the Android SDK environment Download the Android SDK of the corresponding development platform from the Android developer website. I downloaded the Linux SDK with the version r18.
For Windows, you can download the installation package and double-click it. you can skip this section. If you use Linux like me, follow these steps.
Assume that the installation directory is ~ /Apps/. create a directory or modify command parameters as needed.
Extract
Tar zxvf/path/to/android-sdk_r18-linux.tgz
Move the extracted files to the target directory.
Mv android-sdk-linux /~ /Apps/android-sdk-linux
Configure environment variables for ease of use. In ~ /. Add the following content to bashrc.
# Android SDK
ADT = $ HOME/apps/android-sdk-linux
PATH =$ {PATH }:$ {ADT}/tools: $ {ADT}/platform-tools
Log out of the current terminal and log on again, or execute the following command.
Source ~ /. Bashrc
Use the SDK to install the required virtual image Run the following command to enable Android SDK Manager.
Android
Select Android SDK Tools and Android SDK Platfor-tools, and install SDK Platform and Google APIs under Android2.3.3.
Create a virtual device Run the following command to enable Android Virtual Device Manager.
Android avd
Click New to create a device. Enter the device name android, Target 2.3.3, and SD card size 512MiB.
The creation is complete.
Start virtual devices and related tools and install apk Emulator-netfast-debug proxy @ android
Sudo 'which ADB' start-server
Adb install xxx.apk
Start Debugging Select the software to install on the virtual device interface to perform application operations.
Because we have specified the debugging network proxy when starting the simulator, the network interaction during software operation can be seen under the simulator terminal.-Squid is used as the proxy during actual testing. Repeated tests show that the output content is not reproduced and must be verified.
Solution 2 use TCPDUMP for real-machine testing Methods for preparing the Android environment have been described earlier.
Device preparation In principle, this debugging can be performed on any mobile phone or tablet that installs the Android system. Due to the needs of this test, you need to ROOT and enable the developer mode. The operation method is not described here (there are too many related articles on the Internet ).
I tested an HP TouchPad and installed CM9.
Software Download
Tcpdump-Arm
Upload tcpdump-arm to the device
Adb push tcpdump-arm/data/local/
Log on to the device and set file permissions.
Adb shell
Cd/data/local/
Chmod 777 tcpdump-arm
Installation package
Adb install xxx.apk
Start Debugging Select the software to install on the virtual device interface to perform application operations.
Still use the computer to enter adb shell, start tcpdump-arm, and start to capture data packets.
./Tcpdump-arm-s 1500-n-w result. cap
The preceding command uses the-w parameter to save the packet capture result to a file for further analysis.
Copy the result file from the device.
Adb pull/data/local/result. cap ./
View with wireshark
Wireshark result. cap
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.