8 min read

Top 10 Most Common Mistakes That Android Developers Make: A Programming Tutorial

View all articles

Android. What’s not to like about this platform? It’s free, it’s customizable, it’s rapidly growing and it’s available not just on your phone or tablet, but on your smartwatch, TV and car too.

With the latest Lollipop update, Android programming continues to improve. The platform has matured quite a bit since the initial AOSP release, and set the user expectations bar quite high. Look how good the new Material design pattern looks!

There are thousands of different devices, with different screen sizes, chip architectures, hardware configurations, and software versions. Unfortunately, segmentation is the price to pay for openness, and there are thousands of ways your app can fail on different devices, even as an advanced Android programmer.

Regardless of such huge segmentation, the majority of bugs are actually introduced because of logic errors. These bugs are easily prevented, as long as we get the basics right!

Here’s an Android programming tutorial to address the 10 most common mistakes Android developers make.

Learn Android programming at a more advanced level with this tutorial.

Common Mistake #1: Developing for iOS

To my great pleasure, this Android mistake is far less common nowadays (partially because clients are beginning to realize that the days when Apple was setting all the design standards are long gone). But still, every now and then, we see an app that is an iOS clone.

Don’t get me wrong, I’m not an Android programming evangelist! I respect every platform that moves the mobile world a step forward. But, it’s 2014 and users have been using Android for quite a while now, and they’ve grown accustomed to the platform. Pushing iOS design standards to them is a terrible strategy!

Unless there is a super good reason for breaking the guidelines, don’t do it. (Google does this all the time, but never by copy-pasting.)

Here are some of the most common examples of this Android mistake:

  1. You should not be making static tabs, and they don’t belong on the bottom (I’m pointing at you Instagram).
  2. System notification icons should not have color.
  3. App icons should not be placed inside a rounded rectangle (unless that’s your actual logo ex. facebook).
  4. Splash screens are redundant beyond the initial setup/introduction. Do not use them in other scenarios.
  5. Lists should not have carets.

These are just a few of the many other small things that can ruin the user experience.

Common Mistake #2: Developing for Your Android Device

Unless you are building a kiosk/promo app for a single tablet, chances are your Android app won’t look good on every device. Here are a few Android programming tips to remember:

There are literally thousands of possible scenarios, but after a while you develop a sense for covering them all with a handful of cases.

You don’t own thousands of devices? Not a problem. The Android Emulator is super good in replicating physical devices. Even better, try out Genymotion, it’s lightning fast and comes with a lot of different popular preset devices.

Also, have you tried rotating your device? All hell can break loose…

Common Mistake #3: Not Using Intents

Intents are one of Android’s key components. It’s a way of passing data between different parts of the app or, even better, different apps on the system.

Let’s say you have a gallery app that can share a download link to some images via SMS. Which of the two options seems more logical?

Option 1:

  • Request the SEND_SMS permission.

      <uses-permission android:name="android.permission.SEND_SMS" />
  • Write your own code for sending SMS using the SmsManager.
  • Explain to your users why your gallery app needs access to services that can cost money, and why they have to grant this permission to use your app.

Option 2:

  • Start an SMS Intent and let an app designed for SMS do the work

      Intent sendIntent = new Intent(Intent.ACTION_VIEW);
      sendIntent.setData(Uri.parse("sms:" + telephoneNumber));
      sendIntent.putExtra("sms_body", x);

In case that you have any doubts, best solution is option 2!

This approach can be applied to almost anything. Sharing content, taking pictures, recording video, picking contacts, adding events, opening links with native apps, etc.

Unless there is a good reason to make a custom implementation (ex., a camera that applies filters), always use Intents for these scenarios. It will save you a lot of programming time, and strip the AndroidManifest.xml of unnecessary permissions.

Common Mistake #4: Not Using Fragments

A while ago in Honeycomb, Android introduced the concept of fragments. Think of them as separate building blocks with their own (rather complex) life cycles that exist inside an Activity. They help a lot with optimizing for various screens, they are easily managed by their parent activity, can be reused, combined and positioned at will.

Launching a separate activity for each app screen is terribly inefficient, since the system will try to keep them in memory as long as it can. Killing one won’t free the resources used by the others.

This Android programming tutorial recommends the proper use of fragments to make your app more efficient.

Unless you want to dig deep into the Android core and read this article, advocating against fragment usage, you should use fragments whenever possible. It basically says that fragments and cursor loaders have good intended purpose, but poor implementation.

Common Mistake #5: Blocking the Main Thread

The main thread has a single purpose: keeping the user interface responsive.

Although the science behind measuring the frame rate our eyes/brain can perceive is complex and influenced by a lot of factors, a general rule is that anything below 24 fps with delay greater than 100 ms won’t be perceived as smooth.

This means that the user’s actions will have a delayed feedback, and the Android app you have programmed will stop responding. Stripping the user of his control over the app leads to frustration, frustrated users tend to give very negative feedback.

Even worse, if the main thread is blocked for a while (5 seconds for Activities, 10 for Broadcast Receivers), ANR will happen.

As you learn Android programming, you will come to know and fear this message.  Follow these Android programming tips to minimize this occurrence.

This was so common in Android 2.x, that on newer versions the system won’t let you make network calls in the main thread.

To avoid blocking the main thread, always use worker/background threads for: 1. network calls 2. bitmap loading 3. image processing 4. database querying 5. SD reading / writing

Common Mistake #6: Reinventing the Wheel

“OK, I won’t use the main thread. I’ll write my own code that communicates with my server in a background thread.”

No! Please don’t do that! Network calls, image loading, database access, JSON parsing, and social login are the most common things you do in your app. Not just yours, every app out there. There is a better way. Remember how Android has matured and grown as a platform? Here’s a quick list of examples:

  1. Use gradle as a build system.
  2. Use Retrofit / Volley for network calls.
  3. Use Picasso for image loading.
  4. Use Gson / Jackson for JSON parsing.
  5. Use common implementations for social login.

If you need something implemented, chances are it’s already written, tested and used widely. Do some basic research and read some Android programming tutorials before writing your own code!

Common Mistake #7: Not Assuming Success

Great. We have learned that there is a better way for handling long running tasks, and we are using well documented libraries for that purpose. But the user will still have to wait. It’s inevitable. Packages are not sent, processed and received instantly. There is a round trip delay, there are network failures, packages get lost, and dreams get destroyed.

But all this is measurable. Successful network calls are far more likely than unsuccessful ones. So why wait for server response before handling the successful request? It’s infinitely better to assume success and handle failure. So, when a user likes a post the like count is immediately increased, and in unlikely event that the call failed, the user is notified.

In this modern world immediate feedback is expected. People don’t like to wait. Kids don’t want to sit in a classroom obtaining knowledge that has uncertain future payoff. Apps must accommodate to the user’s psychology.

Common Mistake #8: Not Understanding Bitmaps

Users love content! Especially when the content is well formatted and looks nice. Images, for instance, are extremely nice content, mainly due to their property of conveying a thousand words per image. They also consume a lot of memory. A lot of memory!

Before an image is displayed on the screen, it has to be loaded into the memory. Since bitmaps are the most common way to do this, we’re going to provide an Android programming guide for the whole process:

Let’s say you want to display an image on your screen that you just took with your camera. The total memory needed for this is calculated with the following formula: memory_needed_in_bytes = 4 * image_width * image_height;

Why 4? Well, the most common / recommended bitmap configuration is ARGB_8888. That means that for each pixel we draw, we need to keep 8 bits (1 byte) for the alpha, the red, the greed and the blue channel in memory, in order to properly display it. There are alternatives, like the RGB_565 configuration that requires half the memory than ARGB_8888, but loses the transparency and the color precision (while maybe adding a green tint).

Let’s assume you have a brand new device with full HD screen and 12 MP camera. The picture you just took is 4000x3000 pixels large and the total memory needed to display it is: 4 bytes * 4000 * 3000 = 48 MB

48 megabytes of your RAM just for a single image!? That’s a lot!

Now let’s take the screen resolution into consideration. You are trying to show a 4000x3000 image on a screen that has 1920x1080 pixels, in worst case scenario (displaying the image full screen) you shouldn’t allocate more than 4 * 1920 * 1080 = 8.3 MB of memory.

Always follow the Android programming tips for displaying bitmaps efficiently:

  1. Measure the view you’re showing your images in.
  2. Scale / crop the large image accordingly.
  3. Show only what can be displayed.

Common Mistake #9: Using Deep View Hierarchy

Layouts have an XML presentation in Android. In order to draw content, the XML needs to be parsed, the screen needs to be measured, and all the elements need to be placed accordingly. It’s a resource- and time-consuming process that needs to be optimized.

This is how the ListView (and more recently the RecyclerView) works.

If a layout has been inflated once, the system reuses it. But still, inflating the layout must happen at some point.

Let’s say you want to make a 3x3 grid with images. One way of doing this is a vertical LinearLayout containing 3 LinearLayouts with equal weight, each of them containing 3 ImageViews with equal weight.

Some Android programming beginners don’t always make the best use of LinearLayouts.

What do we get with this approach? A warning that “nested weights are bad for performance”.

There is a saying in the Android programming world, that I just made up: “With little effort all hierarchy can be flattened”.

In this case RelativeLayout or GridLayout will efficiently replace the nested LinearLayouts.

Common Mistake #10: Not Setting the minSdkVersion to 14

Well, this is not a mistake, but it is bad practice.

Android 2.x was a huge milestone in developing this platform, but some things should be left behind. Supporting older devices adds more complexity for code maintenance and limits the development process.

The numbers are clear, the users have moved on, the developers shouldn’t stay behind.

I’m aware that this doesn’t apply for some big markets with old devices (ex. India), and setting the minSdkVersion to 14, on the Facebook App, means leaving couple of million users without their favorite social network. But, if you are starting fresh and trying to create a beautiful experience for your users, do consider eliminating the past. Users that don’t have the resources, or feel the need to upgrade their device/OS, won’t have the incentive to try out a superior version of your Android app and ultimately spend money on it.

Wrap Up

Android is a powerful platform that evolves quickly. It may not be reasonable to expect users to keep up the pace, but it’s crucial for the Android developers to do so.

Knowing that Android is not just on our phones or tablets is even more important. It’s on our wrists, in our living rooms, in our kitchens, and in our automobiles. Getting the basics right is of utmost importance before we start expanding.

About the author

Ivan Dimoski, Sweden
member since November 26, 2013
Ivan is an accomplished Android developer and consultant with six years of experience developing user-friendly applications for the international market. He has excellent analytical and problem solving skills and enjoys interacting with clients to ensure that specific and business-critical requirements are met. [click to continue...]
Hiring? Meet the Top 10 Freelance Android Developers for Hire in March 2019


Hubert Taler
As usual, useful and insightful article from TopTal. Thanks!
Acep Saepudin
great articles !
Dhruv Patel
Yes, The very first mistake is most common. Some of the client also forcing the Android Developers to create designs like the iOS.
very informative ... thanks !
Luboš Volkov
"Some of the client also forcing the Android Developers to create designs like the iOS." ---> There are 2 approches how to make a multi-platform products working nicely. First one is to stick with the native OS related experiences and follow system guidelines. Second one (more common) ---> You have iOS app done so you "just" re-shape that in to the Android one to save a resources (money, time). To be honest by the end of the day there is not so many huge differences and for each native iOS component you have good substitution on Android too. So if you will do design in smart way its relatively easy to ship iOS design to Android.
nice article thanks sir very useful for me
Awesome -- thanks, this was informative and helpful!
Nice article. Thanks!
সাদ মাহমুদ
Thanks for this beautiful well structured information.
Silvia Hisham
Great Article! Thanks a lot.
C B Newham
A common mistake with common mistake 4: fragments are crap. The Fragment Manager is hideous. It's about time someone came out with a fragment library that works as expected and gives proper access to the fragment stack (and has consistency! cf: Fragment Manager methods available in the support library that aren't available in the standard library).
Harry Martin
Thats good details mentioned in this blog. I would also recommend you to make use of advanced guide http://learnsauce.com where it include step by step approach for developing apps that you are interested to get it done.
Himanshu Gupta
This article was really useful. Thanks a lot! 1. Though I am not so sure (in reference to common mistake #9), how do we replace deep hierarchy with RelativeLayout. Using weights we can define the layouting in terms of percentage, which is consistent for all screen sizes, but how do we do so using RelativeLayout? 2. I was also looking to have some insight around decreasing your apk size, especially when you are planning to put images of all sizes (ld, md, hd, xhd, xxhd, xxxhd) in your apk, but during runtime only one of them is going to get used.
Sadaf Malik
Got some great insights. You pointed out lots of problems I have noticed myself as an Android user too. I do love the idea of fragments. Maybe once Android developers show more faith in this OS, they will stop trying to incorporate iOS ideas into Android apps. Regards Sadaf, Incubays Singapore: http://incubasys.com.sg
very useful..thanks!
Onur Çevik
Thanks for the useful article, Ivan.
Pavitra Kansara
Nice read. Can you explain #1.1 "You should not be making static tabs, and they don’t belong on the bottom"? What are the possible loopholes with this design implementation?
Jonathan Caines
This is my year one working as a Developer in the Ukraine and I found this article very helpful in my work. And this was helpful as well I got good gift card. Only for Ukrainian Developers! https://form.jotform.com/61057413264147
my biggest issue generally with buttons at the bottom is that my Android device has 3 hardware buttons at the bottom, and sometimes it happens that I accidentally press Back instead of some in-app button.
Roberto Mejia
Could someone please answer me this question ? I'm new in android programming and interested in saving some data in sqlite db...lets says an article.... now, imagine this article has some list of instructions...sorted or unsorted...like Instruction's title 1. instruction 1 2. instruciont 2 how can i achieve this ? i wonder if final presentation will be "readable" o.O someone has any idea ?
Pradeep Kumar Reddy
in onScrollChange() method i'm creating some views and adding to the main layout. Because of this the scroll is not smooth. How to resolve this issue. I tried to create a asyncTask for creating the views, but doInBackground() method does not allow creating views.
Federico Ponzi
Thanks for the useful article.
Saksham Goyal
nice article. very helpfull
Yogeshwar Suvarnkar
HI, I have a question that, I am having a listview with adapter with large no of data and listview contain the textview which show like count so what i am trying to do is, the like count is updated on next screen, but when user come back to the previous screen then i want to show that increamented like count in listview, so how can i do that ? any solution will be greatly appriciated. Thanks in Adavance...
Android development, much like software development, is a fun and rewarding pastime (or work, if you call it that). The above is a non exhaustive list of some common mistakes newbie Android developers tend to make. There is only one way to become an experienced Android developer, and that is to keep developing apps.
Zakir Shikhli
Nice article, but anyway I think the biggest mistake is to use Android SDK with Android studio to develop Android applications. This is from far the worst development environment I never seen and it's terribly not efficient. If you don't do this mistake, the others will disappear. There is a lot of alternative which are using NDK (C++, native code, much better than Java) and are also often multiplatform. I like Google and Android, but the development environment is absolutely not suitable for professional development, and I even not mention all problems that you can meet with gradle build system and it's dependencies.
gregoryallen caldwell
maybe YOU can help me! i had a moto E...all my pictures looked clear,even big ones from my canon camera i moved to my phone..incoming,outgoing. It died and i bought a samsung galaxy j7..my pictures look like shit..my wife txt me pictures they are blurry,small pixilated..when i send a picture,a GOOD picture, in txt message, it says converting blah blah media whatever...then it looks like shit.. why is my newer more expensive phone destroying all my pics before i send then and destroying all incoming pix ??
gregoryallen caldwell
sometimes i do the opposite...sending a thumbs up to a total stranger in FB messenger ) :
Sanjog Shrestha
for that you I suggest you to populate the date and notify your adapter onResume.
Muller Agaasi
No doubt you wrote basic principles for android developers services for all industries. I would like to add some more tricks & convention that will satisfy your clientele list, For example……Prototype, Know your mediums, heavy backgrounds consumes battery, downloading megabytes of data, various screen sizes & user experience. Source: http://www.appmaisters.com/android-development/
What's not like is the shitty fucking development environment that google forces people to use .l nothing fucking works with this piece of shit.Every time you upgrade Android Studio ,it is a new adventure fixing their shitty fucking environment. I've used Eclipse for 10 years and Android studio is a huge step backwards.
Cruikshank D
So true! I have to update my Android app each month for updating data, but I absolutely dread launching Android Studio because I know it's an hour effort of updates, then subsequent tweaks to get things working again. Argh!
Oscar Campbell
#1 mistake on a blog where information freshness is of relevance: no clearly visible date at the immediate top of the post! ;-) I usually don't even bother to read articles unless they're clearly timestamped and current enough for the subject. Checked the comments for hint this time. Aside from that meta suggestion: some good points you've made!
Chuck Norris
I am running version 2.3.3 of Android Studio. At least once an hour it would freeze and I would have to go into the Window task manager and kill it and then restart it, it really pissed me off. The whole process of killing/restarting takes about 10 minutes with 4GB of RAM. I stumbled on to a post on the internet that recommended using "run as administrator" when you fire up Android Studio. Since I have started doing that 99% of Android Studio problems have gone away. It's still buggy but getting better. You may want to give it a try.
Chuck Norris
Just make sure that you are disconnected from the internet when you start Android Studio that way can avoid the forced updates.
yes , These are the problems faced by the developers and same problems were faced by organisation, who develop a android App for me after that i am connected with xicom technologies .. They resolve all the problems related to my app. http://www.xicom.ae/
Brill Pappin
I would love to see this updated for 2018, because four years is a *very* long time in the mobile world, but this article is still useful.
The funny part is that it's recommended to use fragments, but all Android examples are using activities.
I feel less alone... Google went totally wrong on choices about development for Android, and it is getting worst every day... After ten years they provide the ConstraintLayout and they are even proud of that. Did they realize at API 25 that relative positioning can be useful with thousands of different screen size to handle ? The support API is a mess, the adapter-view system is terribly bad (still don't understand why they don't choose MVC? ) and the worst for me is the GUI design because you fell like writing half an OS to make simple things....
Common Mistake #1: Using Android Studio and Android SDK to develop Android Apps.
Interesting Article! They say it’s best to learn from other mistakes and here are the 5 major mistakes to avoid during android app development https://goo.gl/ZiUstG
Firoj Mohammad
Hi very nice article keep it up. You could also find something interesting here are: <a href ="http://androidtutorialonline.com/top-android-libraries-every-developer-should-know/" >Top Android libraries every developer should know </a>
comments powered by Disqus
Free email updates
Get the latest content first.
No spam. Just great articles & insights.
Free email updates
Get the latest content first.
Thank you for subscribing!
Check your inbox to confirm subscription. You'll start receiving posts after you confirm.
Trending articles
Relevant Technologies
About the author
Ivan Dimoski
Java Developer
Ivan is an accomplished Android developer and consultant with six years of experience developing user-friendly applications for the international market. He has excellent analytical and problem solving skills and enjoys interacting with clients to ensure that specific and business-critical requirements are met.