Play a game to build and debug the development environment
foreword
In view of the fact that the development of Wanyiwan can only be developed based on the Mac platform at present, because the students in the project team do not have Android development and debugging experience, they are not very skilled in operation, and the IOS debugging operation is inconvenient, so I will share it here. If you are an old driver, you can ignore this article. . -By Javen
Mac computer recommended installation:
iTerm2 replaces the default terminal (Terminal)
iTerm2 personalized theme configuration
Sublime Text
sublime text 3 plugin recommendation
Android debugging
Download Android Studio
If conditions permit, go to the official website to download
Android peripheral software and plug-in download-By AndroidDevTools
Note:
1. When installing AS, it is best to choose a custom installation and specify the directory where the SDK is saved. This directory will be used when configuring adb
environment variables later.
2. If there is an abnormal download, you need to surf the Internet scientifically (build a ladder yourself) or set up an agent
. 3. If you are interested in building a ladder, you can refer to here.
Configure environment variables
Suppose you save the above SDK directory as /Users/Javen/Documents/work/Android/sdk
. When you configure, please modify the configuration directory by yourself.
Enter the user's current directory
cd ~
Set environment variables
Edit Add the following vi .bash_profile
to this file: Remember to modify
#Android
export ANDROID_HOME=/Users/Javen/Documents/work/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
Settings take effect
After saving the above configuration, use this command source .bash_profile
to make the configuration take effect.
Note: If you use it
zsh
, what is itzsh
? You need to~/.zshrc
add it in the last line of the filesource ~/.bash_profile
. If you don't add this setting, the environment variable will not take effect every time you create a new window, and you need to manually execute it to take effect.
Check if the configuration is normal
Use the command adb devices
If it appears List of devices attached
, it means that the configuration is successful. If the command not found: adb
configuration does not take effect, please check the directory set in the environment variable.
Download Special Edition Test Q
Refer to the official access unified framework description
Test Q use special instructions
1. All game directories are
/sdcard/tencent/MobileQQ/.apollo/game/
2. After the special version test Q is downloaded and installed, the "CM Show game resource checksum update" in the settings is enabled by default. If you want to debug the local game resources, please use this 关闭
, because when this function is enabled, mobile QQ will check the signature of the local game resources and download the corresponding version from the server if they are inconsistent.
3. The game ID will only be generated when the resource package is uploaded to the platform. If you feel that the operation is troublesome and just want to test, you can just find a game test that has been online on the platform (delete the resources in the game and replace them with the resources of your own test game) , most of the test functions are not affected.
Introduction to common Android commands during debugging
Since multiple devices will be used during the test, how can I view the list of connected devices?
1. View the device list
adb devices
E.g:
➜ ~ adb devices
List of devices attached
4f61217b device
a5f9e448 device
Now that there is a device to connect to the computer, how to connect the terminal device?
2. Connect the device
adb shell
-s
Specify device can be used when multiple devices are connected
adb -s 4f61217b shell
3. Upload files
adb push [本地文件] [本地文件夹]... [设备目标文件夹]
-s
Specify device can be used when multiple devices are connected
adb -s 设备ID push [本地文件] [本地文件夹]... [设备目标文件夹]
E.g:
adb -s 4f61217b push inviteIcon.png gn gn_6 common main.js script /sdcard/tencent/MobileQQ/.apollo/game/2445
4. Download the file
adb pull [设备文件] [设备文件夹]... [目标文件夹]
-s
Specify device can be used when multiple devices are connected
adb -s 设备ID pull [设备文件] [设备文件夹]... [目标文件夹]
E.g:
adb -s 4f61217b pull /sdcard/tencent/MobileQQ/.apollo/game/2446 ./
5, log input to file
adb -s 4f61217b logcat -v time process > /Users/Javen/Documents/logs/xiaomi.log
Note: If there is an abnormal phenomenon in the AS viewing log, you can use this command to input the log to a file. If you want to end the monitoring of the log, you can use theCtrl + C
log filter keywordsava_native_log
IOS debugging
Refer to the official documentation - development and debugging
Personal ability is limited, welcome to correct me if I am wrong. If you have a better solution or suggestion, welcome to communicate and discuss together. If you have any questions, please consult.