1. Problem background

Our company has developed an app. A small number of users reported that they would crash after opening the APP authorization notification permission. However, we have passed several testing machines and failed to reproduce this problem, which is more difficult.

2. Challenges encountered

Since we are an entrepreneurial company, we don't have too much budget to buy many types of test machines. Each brand of Android machine has only one model of test machine, and the system version cannot be fully covered. The same is true for Mac machines. In the event of a crash, it is difficult to locate the wrong place based on the user's description alone. Does the user occupy too much memory? Insufficient disk space? Or is it a crash caused by a logical problem? Moreover, we use mixed development, the framework uses ionic, and most of the pages and logic are mixed development. Since the App involves the Bluetooth connection related SDK and DFU firmware upgrades, and ionic does not encapsulate the corresponding interface in this section, we still develop this part of the content through the original development, and then use ionic to call the original content. This further increases the difficulty of debugging.

Third, the steps to solve the problem

In order to find the cause of the crash, we first eliminated the problem caused by insufficient machine memory and disk space. We eliminated this factor by uploading the total memory size of the user's mobile phone, the size of the remaining memory, the total disk space and the remaining disk space. After that, we considered whether it was caused by some problems in the code logic, so we tried to use the U-APM product of Youmeng, which has a good crash analysis tool, and you can see some information about the crash, including the wrong ones. The type, the specific line that caused the error, the frequency of occurrence, and the machine-related parameters are very helpful to our debugging, so we tried to install the SDK of Youmeng, set up the email and Dingding error reminder, and released it A new version of the APP. Two days later, after these users reopened the App, they also experienced a crash after authorized permission. At the same time, we also received error reminders and DingTalk reminders from Youmeng. After clicking into it, I found that U-APM helped locate the wrong place. As shown in the figure below, in the 93rd line of MainActivity.java, ArrayIndexOutOfBoundsException appeared, that is, the array index exceeds the array length -1, and the specific crash time and machine parameters At the same time, I also summarized it and helped us to summarize useful information. We found that this phenomenon only appeared in Honor series phones, so we strengthened the test of Honor series phones, and opened it after manually closing the permissions in the system. This problem was reproduced in the use case of the app, and the root cause was also found, because when the user manually closes certain permissions, the callback returns an empty array, and when we go to get the value marked as 1, it will be Caused an error.

After the repair, we will continue to use Youmeng to observe whether the problem has been resolved. Since the problem has been fixed and a new version has been released, this error will no longer be reported.

Four, summary of the problem

Sometimes crashes are encountered and cannot be reproduced. As a developer, it is really a headache. Using U-Meng's U-APM product can help us locate the problem more quickly, summarize the corresponding situation, and help us to go more proactively. Find problems, solve them, and improve the user experience.

Author: Liang Likun
I usually love to specialize in technology, and I am good at using various Saas platform tools to help the team improve the efficiency of development, deployment, operation and maintenance, and troubleshooting.


性能优化实践者
11 声望220 粉丝