5 Reasons Your App Crashes and How to Fix Them

5 Reasons Your App Crashes and How to Fix Them

In 2016, on the eve of the Black Friday sales frenzy in the US, a research firm called Apteligent released a report estimating how much money firms could lose if their apps crashed on the big day. The report tallied up the amount of money spent by retail app customers on Black Friday the previous year and worked out what would happen if every customer experienced at least one crash during peak hours.

Amazingly, the authors found that nearly $300 million was at stake. And that’s just one country, on one day of the year.

This startling figure shows us the importance of making apps as crash-proof as possible. Your app may not be as high-profile as Instagram, which sent billions of selfie enthusiasts into frenzy when it crashed recently. But it is still vital to your business. If your app fails you risk forfeiting a small fortune in transactions, not to mention torpedoing your user base. Some estimates suggest that over 50% of users may uninstall an app if it crashes, freezes or behaves abnormally.

But how do we keep our apps working, and prevent those hugely damaging outages? Well at Bugfender we’re passionate about helping developers around the world make their applications as reliable as possible, so we’ve compiled a number of common reasons why apps crash – with hacks to help you fix them.

Poor Memory Management

Some developers design and build their app to behave like Mariah Carey or Cristiano Ronaldo. Their apps behave like little digital divas, hogging all the phone’s attention – and draining its resources.

Unfortunately this often leads to crashes. An app will never have all a phone’s resources to itself, so if developers build apps which eat up a huge part of a phone’s memory, they’re sowing the seeds of future problems. Poor memory management is one of the most common reasons for app crashes on mobile devices, and this is especially true for low-end mobiles and tablets.

How to Fix

The key thing to remember is that your app is a single entity in a larger ecosystem and you must think about many other resource-hungry factors in addition to your own prized creation. Bear in mind that many users won’t have the high-end phones that developers possess, and memory allocation problems are common.

Interestingly, Android’s ecosystem provides really powerful memory management tools which mean developers have the freedom to handle memory as they like (the disadvantage is the complexity of the process). For iOS, the Swift and Objective-C programming languages offer very efficient tools to manage memory, mostly automatically. Nonetheless, iOS developers need to ensure they understand how memory management works.

In terms of specific memory issues, apps can often run into trouble when managing files of
multiple megabytes, such as images. The trick here is to load only the parts of the file needed at each time, instead of loading it in memory. Using the example of images, you may want to build a resized version with the exact size it will have on screen.

When managing large view hierarchies, you may also want to get rid of views that are hidden or off-screen. The most prominent example is lists and tables; you need to be careful with these if you want to recycle views properly.

Also bear in mind that, when apps are carrying out complex calculations, your phone may need to free up memory in the middle of the process. With Android devices this is managed automatically by the system, but in iOS it might be necessary to create an auto-release pool.

If you want to see great examples of small apps which punch above their weight, check out Vanilla Music, a simple music player, and a dictionary app called Instadict. Amazingly, both weigh less than 750KB. Several of the heavyweight apps like Facebook, Pinterest and Instagram now have their own ‘lite’ versions and it might be worth taking a look at these mini-apps to get some tips on how to streamline your own creation and cut all the excess fat away.

Be A Superhero

Fend off bugs and keep your users safe.

Use Bugfender for Free Today

Error Handling

No matter how much you try to make your app as resilient as possible, there are some variables and parameters that are simply out of your control. If a user’s Wi-Fi goes down during a file transfer, for example, or they simply enter an incorrect value into a field, it could send the app haywire.

Unexpected problems like this can often lead to a crash, which is frustrating for users. However, there are situations in which an app may not crash, and just leave a user hanging, not knowing what’s happening. This uncertainty can be even more frustrating than an actual crash. So it’s important to ensure you’ve accounted for such errors and put handling conditions in place.

How to Fix

If you find your app has developed a fault, it’s good practice to terminate all activity and inform the users about it. That may sound counterintuitive, but by proactively managing your communication with users and giving them advance warning of any outages, you are likely to retain them for a much longer period.

When crafting your error messages, make them informative and useful. Avoid technical jargon and developer-speak; simply explain in layman’s terms what happened so any user can understand. Also offer a solution to enable the user to rectify the problem. A good error message could read: “Oops! There is no Internet connection right now, maybe look for a good spot and try again?”

Software Lifecycle and Development Process

The concept of iterative app development – the release of an early working version to market and piecemeal improvement thereafter – carries several obvious advantages. You can gauge user reaction, identify problems, create a marketing buzz and get the edge on potential competitors if you’re racing to roll out a potential game-changer. Resources can be channelled from documentation to design and changes to the project are less costly than in the traditional ‘waterfall’ process of build, test and release.

But iterative app development also poses several challenges. The complexity of a stage-by-stage rollout means you’ll need top-notch project managers to keep track of everything. Every time you release a new version or feature, all the previous tests must be redone. The need to integrate third-party services and APIs can place a real burden on your development team, particularly if your company is smaller. OS manufacturers like Samsung, Google and Apple regularly release their own updates, which can really throw you off course if you’re still tinkering with your own product.

Simply put, the earlier you release your app to market, the more likely it is to contain flaws. Unfortunately, if an app keeps crashing users won’t care whether it’s a first-stage prototype, or the final version. They’ll simply forget about it.

How to Fix

If you’re thinking of going down the iterative route, you need to be clear that you have the resources and that your project justifies this strategy. For large-scale projects, iterative may be the way to go, but you may find that a small project gets fiendishly complicated when broken down into even smaller stages, so it may be more suited to the build-test-release route.

If you do decide on iterative development, you need to be ready for any potential issues with OS and third-party APIs. We don’t mean that you should anticipate these issues ahead of time – it’s almost impossible for developers to do that – but you should think about any potential problems which could arise, and be ready to update your app as soon as a new version of an OS or third-party API is released.

Poor Network Management

Due to the nature of their job, most developers have access to a fast internet connection. But this can be a problem in the planning process; a common mistake developers make is assuming that we all live in a 20mbs utopia.

The fact is that a significant number of your users will have a far slower connection, and they’ll need that connection for all manner of things, from retweeting memes about Donald Trump to finding out what time their country is playing in the World Cup. If you forget this then you expose your app to crashes, as a high dependency on network resources combined with slow internet access can significantly reduce the responsiveness of an app. This in turn leads to poor performance, instability and some unfortunate down-time.

How to Fix

When building your app, try to throttle your network speed. Test the product on slow networks and mobile networks with bad coverage (we can think of a few, as it happens). If you don’t fancy climbing a mountain or wrapping your phone in aluminium foil, you can easily find tools to simulate slow network speeds. For iOS, you can download the Network Link Coordinator from Apple’s developer page. For Android, you can download the emulator from the Android SDK. Both tools will enable you set your own internet speed.

Once you’ve throttled the pace, make sure your app is optimized to work in these conditions. And be sure to display meaningful notifications to users when sufficient speeds aren’t available.

Poor Testing

It’s amazing to think that the iPhone is only 11 years old. Since that momentous day on June 29, 2007 when Steve Jobs’ most famous creation was unveiled, it has spawned nearly 40 different iPhone and iPad models. If you think that’s a lot, check out the number of Android models; back in 2015 it was estimated that there were more than 24,000 variants worldwide, and with all the different manufacturers out there, it’s impossible to keep a full tally.

With the pace of roll-outs increasing all the time, it’s becoming increasingly difficult for developers to test their apps on real devices, especially if they have a low budget. Various simulators and emulators are available but these have their own drawbacks. They cannot mimic the effect of low or overheated batteries, the interruptions of incoming calls or the interaction with a device’s camera. The data produced by a simulator may carry further limitations as, unlike an emulator, it does not replicate the hardware of a device. It’s important to always test an app in full, on at least one device.

How to Fix

Releasing apps into the market without adequate testing leads to lots of stability and performance issues. However there are measures that can be tailored to effectively combat bugs when they, inevitably, arise. Tools like Bugfender help developers test their apps on real devices with real users, enabling them to easily find bugs and fix issues as soon as possible. Bugfender collects usage logs locally and sends them to the our web portal when a network connection is available. The Bugfender solution is equipped with a load of new features, including a remote logger, issue tracker and crash reporting functionality, meaning it is a great all-in-one solution for mobile app debugging.

as_napster Created with Sketch. as_disney Created with Sketch. as_eye-d Created with Sketch. as_sk_telecom Created with Sketch. as_websummit Created with Sketch. as_aimail Created with Sketch. as_taxify Created with Sketch.

Already Trusted by Thousands

Bugfender is the best remote logger for mobile apps.

Get Started for Free, No Credit Card Required