Quantcast
Channel: rm core
Viewing all articles
Browse latest Browse all 16

Always Test On A Real Device, Lessons Learned Making Android Apps As A Side Project

$
0
0
bad app reviews screenshot
Reviewers are merciless for Apps that crash.

Let’s talk testing. By my definition of done, your Android App isn’t complete until it has been tested. Not only is it irresponsible to publish an App to the play store without testing it, reviewers will have no mercy if you have a crash prone App.

You don’t want to be in a position of trying to recover from the momentum of negative App reviews. That’s why the rest of this article discusses testing your App on at least one real Android device. (Note: this article is part of a series about making Android Apps as a side project. Click here to  read the introduction.)

With Great Power Comes Much…Danger

belt fed machine gun with null round
Programmer beware the null round.

The power of Java is one of the reasons it is possible to create an App that solves a real problem in your spare time. All is not sunshine and roses however. Danger lurks alongside the power of Java. I think Bjorn Tipling said it best in his article “If programming languages were weapons

Java is a belt fed 240G automatic weapon where sometimes the belt has rounds, sometimes it doesn’t, and when it doesn’t during firing you get an NullPointerException, the gun explodes and you die.

Imagine yourself staying up late at night, after the kids have gone to bed, working on some new feature for your App. You put the finishing touches on the code, unit test it, generate a signed release build and completely uninstall and re-install the App for testing on a real device. As soon as you try the new feature in the release build you get the dreaded “Unfortunately, App has stopped” error message.

This all too common scenario is most likely caused by a Null Pointer Exception in Java. It is very frustrating when this happens, but because you tested on a real device, at least it happened to you and not your customers. Catching these kinds of errors is the primary reason to always test your App on a real device. Real devices running a fresh install of a release build often uncover errors that don’t show up in the Android emulator.

Where To Get Android Test Devices

picture of four android test devices
Is it the Android developer’s lot in life to have a lot of test devices?

If you already have an Android phone or tablet, great. You have everything you need to get started. I only used one Android phone for the first year that I had Apps on the play store. I also had a colleague at work who would run pre release versions for me on his Android phone. Testing on this additional device provided an extra sanity check.

If you don’t already have an Android device, I find the best place to buy one on a budget is from eBay. I have bought two used phones from eBay for testing purposes. I can offer you these tips when buying a used device from eBay.

  • You don’t necessarily want the cheapest device listed on eBay.
  • Be careful to avoid nonworking devices being sold for parts.
  • Don’t buy a phone that is listed by a parent of a teenage girl who has worn it out through constant texting.

The most recent test phone I bought on eBay cost $24 delivered. This low cost device is also running Android 4.0, an older version of Android at this point. This allows me to make sure that my Apps will run on low end devices.

You may also want to consider buying a pay as you go phone. I have seen low spec devices go for as little as $49 at my local electronics retailer.

Finally, there is a market place called swappa that offers used Android devices. In my experience, swappa has higher prices than eBay. They seem to offer higher end devices in good condition. I haven’t actually purchased anything from swappa because the devices from eBay met my testing needs.

Remote Testing of Android Apps

With the multiplicity of Android devices being created, it is not feasible to have on hand every configuration of every device. Remote testing services have arisen to address this problem. Some of these remote services, such as the offering from Samsung are free, others are paid.

I have not needed to use these services personally but it is good to be aware that they exist. It may help you fix a bug that happens on an uncommon device in the future.

Debug Over WiFi/Ethernet

One final note on testing with a real device, be aware that you can debug your Android App over WiFi. This can be helpful in situations where you can’t use a USB cable for some reason.

Connect your device to your development machine and then follow these instructions for testing over ethernet. I appreciate the ability to debug my Apps in a graphical debugger where I can step through code and examine the reasons for a crash. This convenience makes your life easier as a Android developer working on a side project.

Conclusion

An App isn’t finished until it is tested. You should test your App on a real Android device because you will catch errors that don’t show up in the emulator. If you need to buy a test device on a budget, I recommend eBay.

Related Articles

The post Always Test On A Real Device, Lessons Learned Making Android Apps As A Side Project appeared first on rm core.


Viewing all articles
Browse latest Browse all 16

Trending Articles