android: appcompat makes apps 1 MB bigger

In Android, Appcompat is the support library that is required to use the Action Bar and Status Bar Notifications on a range of older devices. But, if you dont need those features in your app, your app will still carry an extra 1MB in size for no reason at all.


  • NotificationCompat is not needed in Android 4.1 (Jelly Bean) and up. just use the built in Notification methods.
  • ActionBar basic features are available from Android 3 API11, and you dont need the support library for the basic action bar features. But if you want to use Lollipop ActionBar features on older devices, down to Android 2.1 (API7), you need the support library.

Advanced Action bar features can be useful on apps that require compact navigation at the top of the window. Some apps will benefit from this, especially apps that want a ‘hamburger’ menu item (3 horizontal lines that mean there is more options in a popout menu).

Appcompat also allows you to develop apps that look and act like they are part of the Android ecosystem. Google wants your apps to look the part, because it makes android look more capable. If your app doesnt look like the android system, the user knows the functionality of your app doesnt come from android, but your app. In its developer guide, Google encourages the use of appcompat, so that apps can use the latest features on obsolete devices. Old Android devices that will never get updated, can still use googles latest services.

In Android Studio, the Appcompat support library is included by default. It will add about 1 MB to the size of your app. If you dont need to use any of the features it provides, you can remove it from your app.

To remove the appcompat dependencies, delete it from your gradle build file, and you may need to remove or change some of the features it depends on:

  • action bar menu items
  • appcompat themes in the styles.xml file
  • NotificationCompat code
  • supportActionBar
  • etc, follow the trail of build errors….
android: appcompat makes apps 1 MB bigger

USB cable reliability, and how to extend cable lifetime

You may have noticed that USB cables sometimes have problems. Sometimes they dont work properly, sometimes the connection between devices is unstable.

Whats the cause?

Usually, this is due to “cable aging”. Cables get old. The metal strands inside the cable break.

Over time, as the cable gets repeatedly bent and twisted, the metal strands in the cable get fractures. The smaller the radius of the bend, the more damage it does. All cables require metal to conduct electricity, and almost always, copper is used. Copper cant handle a lot of bending. It breaks pretty easily. Yet copper is used because it is one of the best conductors, with less power loss than most metals. Its a compromise. Wires have many small strands inside so that they can survive a lot more bending than a single strand – the strands still break, but finer strands take longer to break, and electricity can jump between strands to continue flowing.

For power delivery, this isnt a big deal, because electricity can jump across the tiny gaps as a spark. The ‘turbulence’ this adds to the flow of electrons doesnt affect the delivery of power.

But for data signals, its a really big problem, because the little sparks jumping across the fractures cause the signal to become corrupted. The chaotic turbulence from the spark interferes with the controlled variations in electron density that is the data signal. It addds “noise” to the signal.

once a cable gets too many internal fractures, the signal cannot travel through it cleanly and the quality of the signal may not be good enough for the receiving device to interpret.  kind of like noise in a radio broadcast signal. once the noise gets too much, the broadcast becomes too unclear.

What can you do?

The better you treat your cables (so they are bent as infrequently as possible) the longer they will be reliable. But, eventually, they will need to be replaced. You can replace the wires yourself, if the connectors are still ok, or just get a new cable.

To make your cables last, coil them up in a circle shape, so that the bend radius is as large as possible. store them in a small bag so they keep that round shape. putting loose cables in bags or pockets allows them to be squashed by other things, which creates bends with a small radius.

In the end, its a matter of convenience and cost. If you live in a place where cables are cheap, then its no problem to continue as you are and just buy cables sometimes. if you live in a country where cables are expensive, you may want to change the way you treat your cables, or even learn how to replace the wires yourself.

If you replace your own wires – even simply out of protest against ridiculous prices – keep in mind that better quality cables will have better quality connectors to reuse in this way. check out youtube videos to learn how to do it.

USB cable reliability, and how to extend cable lifetime

Beware of Stack Overflow

The more I learn to develop apps for Android and other platforms, the more reluctant i am to use Stack Overflow as a source of answers to problems. For me, its now a resource of last resort.

When I first started learning to develop apps, i thought Stack Overflow was great. They have an answer for everything! Especially Android problems.

I have since learned that Stack Overflow answers for Android are generally unsuitable for Android. Most contributors to Stack Overflow are more concerned about answering as many questions as quickly as possible, in order to get points, to further their career. They are much less concerned with their answers being correct, or “best practice” for the platform they answer about. They want points.

Stack Overflow is a resource full of hacks and workarounds. The end result is that Stack Overflow is more of a “wild goose chase” than a useful resource. In the end, its quicker to put the app aside and go and learn how to do that thing properly for Android. Then come back to your app and continue. I know that this can be hard to do, but really if will save you time and suffering. Pursuing the quick fix is often the hardest way to get to your final goal.

When developing apps for Android, I usually dont know how to do what i need to do in my app. Heres what i do, that seems to be the quickest way for me to develop apps.

  1. I first go to the Google developer resources. It seems to be the ONLY source of “best practice for Android” coding. To learn something new, i try to find their tutorial on it. To learn how to use certain functions, I search the API guides. Its not just Java Im learning, its Java-for-Android.
  2. If i cant find what i want in Googles resources, I search for third party tutorials. I specifically look for tutorials with code that most resembles what i have seen in Googles resources. The closer i stick to Googles code examples, the less time it takes for me to get the code working.
  3. The rest of the gaps I need to fill in to get my code working, comes from a variety of sources, wherever i can find what i need. A lot from Stack Overflow. S.O. is good for code “one liners”, where i just need a single example or a few lines to fix a problem.

I no longer start with Stack Overflow when i want to learn something new. S.O. supporters will say “well, of course, its not meant for that.”. This is true. Its a resource that seems primarily a supply of answers to difficult little problems. But as a beginner, it offers quick answers to questions, and extensive answers to “how to do this” questions. If those answers were actually correct, I would use it so much more. But, as it now stands , I avoid it.

Beware of Stack Overflow