Home > Article > Operation and Maintenance > What are the 6 common reasons why apps crash?
People hate app crashes, especially when the app slows down or freezes for a few seconds. According to a survey by Dimensional Research, 61% of users expect programs to launch within 4 seconds, and 49% expect input to respond within 2 seconds. If the app crashes, freezes or reports an error, 53% of users will uninstall the app.
Whether your target is consumers or businesses, crash issues can turn them off completely. I spoke to some mobile developers and asked them what the most common crash issues they encountered were, and they gave six common reasons:
1. Memory Management
i Everyone you ask will talk about memory management, and most apps will start many threads taking up system memory. Sachin Agarwal, vice president of marketing at OpsClarity, said that programmers can write code as if the app they are writing is the only one in the app. At the same time, he suggested that when writing programs, they should consider being "good citizens in the application ecosystem." .
Memory issues are not the same for all developers. "In iOS, you can leverage Objective-C to handle large memory issues," said Andrew Whiting, vice president of business development at Solstice Mobile. But the pros and cons need to be weighed. "On Android, you need deeper control over [memory] and you can make it do exactly what you want, but that adds complexity."
"Encountered in Java[Run ] Out of memory, we find that typically it's related to things like loading large images or processing bitmaps," said Jonathan Karon, senior software engineering manager at New Relic. Common causes of problems are compiled in the Mobile SDK Technical Performance Report. "There's actually a surprising number of what looks like linker issues on Android, where the class can't be found, or there's an exception called an unclassified link." iOS apps, on the other hand, are often affected by NSInternalInconsistency exceptions, This is because when a developer changes an array or collection of data in one place, while something else is reading the list of things there.
2. Software life cycle
The iterative application development process and its frequent release of versions opens the door for a minimum viable product to enter the market and then improve it over time, This practice is very popular now. However, the traditional software life cycle has become more complicated due to its dependence on the operating system and third-party APIs.
"If you look at the latest Android updates, there are a lot of app crashes," Agarwal said. "The operating system itself is unstable or the operating system has been updated, but the application has not been updated" or the user does not download the new version. "You have no control over these. It illustrates a core development process."
Mobile and The growth of cloud computing has increased the use of third-party services and their associated APIs, which saves time and helps bring applications to market faster, but they come with their own set of problems.
"Many libraries have a common problem," Whiting said. "They try to solve everyone's problem rather than provide the best solution for anyone." For example, a given API may have performance limitations for a specific application.
APIs may also use tricky techniques, such as iOS method adjustments. When the original code (such as Apple's API) is not available, developers make modifications based on the original code (such as Apple's API). "You could call it one of the 'dark arts' of iOS app development," said Raman Bhatia, head of mobile at Fareportal, an online travel agency. "[But] if your application code is written in a certain way, it can cause crashes."
The API can cause other problems as well. "API latency, error rates, data bandwidth, API version and the number of API requests can all lead to big problems from small issues," Agarwal said. Then there's the API itself, which requires specialized tools to track everything.
API can also cause other problems, such as memory errors. "If you create an object that has been removed from memory before creating other objects, this is usually no problem, but be aware that you don't know whether subsequent objects will need to reference the deleted object." "Especially when you bring in third-party frameworks, problems arise," said co-founder and developer Long Le. "You're never sure what they're cleaning up and what they're creating."
3. Testing is not The need for adequate
testing is obvious, but obtaining adequate coverage, especially with the large number of Android versions and devices, can be challenging. Although there are emulators, the performance limitations of the software running on the server may be different from those on the real machine.
For example, if one thread of an application is reading a database while a second thread is trying to modify the same database, "it's a matter of timing," said Wayne Carter, chief architect of mobile at Couchbase. "If they hadn't collided at the same moment, then the problem wouldn't have occurred and could have been covered up by the log description." Simulators often don't behave the same as the real thing.
Running different systems on different devices is a feasible solution, but this method is more expensive than an emulator. This requires a balance between budget and needs
Testing should incorporate benchmarks of industry standards and user expectations to ensure content is acceptable to developers and users. Testing should also be ongoing. Monitor performance and look for user feedback, then resolve issues as quickly as possible.
4. Network Management
As applications become more and more dependent on the network, whether for data or third-party services, network management has become a source of trouble.
The main reason for crashes is when you are about to obtain data, submit something and wait for recovery, and the APP responds or hangs. Pravin Vazirani, vice president of operations, said that developers may make the Wi-Fi connection function very perfect, but problems will occur when users are in bad network areas.
A good way to deal with network problems is to inform users that the connection is interrupted. , and where possible provide the opportunity to perform other operations that may be of interest. If people understand the cause of a temporary condition that is beyond the control of the application, they are more likely to remain calm and not become annoyed with the software.
5. Error conditions and exception handling
Due to the complexity of mobile development, some errors are inevitable, whether it is unexpected API changes, avoiding previously detected memory issues, or network connectivity situation, or even just slow down the data transfer when transferring large files such as images or videos
In this case, the best approach is to give good error and exception handling. For example, if the user enters incorrect data, or provides text into the text box when a value should be provided, the application will not be accidentally attempted and report an error.
In any of these situations, a properly coded application will notice the unexpected and gracefully terminate the process or activity while notifying the user of the error. If you can keep the lines of communication open, you'll have a better chance of retaining users.
6. Too much code
The best advice is to keep your application simple. Find a plug-in for a specific purpose, use the plug-in and write the necessary code. "The best and most bug-free code is the code you don't write yourself," said Felipe Laso-Marsetti, senior systems engineer at Lextech Global Services, an enterprise mobile development company.
The above is the detailed content of What are the 6 common reasons why apps crash?. For more information, please follow other related articles on the PHP Chinese website!