Image for post
Image for post

Android apps are cryptographically signed by the developer. This allows the package manager on the user’s device to verify that every app update comes from the same source and that it hasn’t been tampered with. Google Play also enforces this signature check when you upload your APK to the Google Play Console, so that even if someone had your login credentials it would be impossible to send a malicious update without also having access to your private key.

Historically, developers were responsible for generating their own private keys and keeping them safe throughout the application’s lifetime. While this offered a lot of flexibility, it was also prone to mistakes: generating weak keys, accidentally checking in your private key to a public repository or even losing it altogether are just a few common ones that happen routinely even to seasoned developers. …


Image for post
Image for post

Co-authored by Dom Elliott and Ben Weiss

Android App Bundle is the new publishing format for Android apps, replacing the monolithic APK. An app bundle is not installed directly. Instead, Google Play generates optimized APKs for each device from the app bundle. Compared to a monolithic APK, the APKs generated from bundles are typically much smaller. The development experience is simpler too, you don’t have to manage and version multiple APKs for different device configurations every release, saving you a lot of time.

The momentum behind Android App Bundle is incredible. Over 450,000 apps and games on Google Play use app bundles in production, representing over 30% of active installs. Apps switching to a[[ bundles have seen, on average, a 16% size saving compared to using a universal APK. …


Image for post
Image for post
Header graphic by Virginia Poltrack

Over the past few months I’ve been working on addressing some of the feedback I got from developers who were using dynamic feature modules in their apps. A common theme was the lack of good testing support and their speed of development being affected by having to upload an artifact to the Play Store to be able to try the module download and installation flows.

Last year, at Android Dev Summit, I gave a talk with some colleagues working on Play’s Dynamic Delivery, in which we teased a new feature in the Play Core library called the FakeSplitInstallManager that makes it possible to perform some of the operations, such as installing on-demand modules, locally. …


Update: Mentions of using ServiceLoader have been removed, as using it for Dynamic Features is no longer supported by R8, and using it without R8 optimizations is not recommended due to performance issues.

In this post I am going to show you how to solve a common problem that arises when using dynamic feature modules in your project: code defined inside them is inaccessible to your base application during compilation… unless you use reflection 😱.

Just the mention of reflection is enough to scare some developers away, but there are a few elegant solutions to safely access what you need using at most one reflection call… and a clever optimization technique to get that number down to zero! …


This article originally appeared on CodeProject.com

Image for post
Image for post

I’m excited that more and more of you are finding success fixing app quality issues using the Android vitals section in the Google Play Console. Since my first article about Android vitals, we’ve been making improvements to bring you new metrics and features. In this article, I’ll start with a look at what’s new, then take you through how to work with the stuck wake locks and crashes.

What’s new in Android vitals

We announced new Android vital features at Google I/O 2018. …


This article originally appeared on CodeProject.com

Image for post
Image for post

For an app developer there is no better measure of success than happy users, and preferably a lot of them. The best way to achieve this is to have a great app that people want to use, but what do we mean by “great”? It boils down to two things: features and app quality. While the former ultimately depends on your creativity and chosen business model, the latter can be objectively measured and improved.

In an internal Google study, conducted last year, we looked at one-star reviews on the Play Store and found over 40% mentioned app stability as an issue. Conversely, people consistently reward the best performing apps with better ratings and reviews. This leads to better rankings on Google Play, which helps increase installs. …


In my previous article I explained why everyone should use ProGuard for their Android apps, how to enable it and what kind of errors you might encounter when doing so. There was a lot of theory involved, as I think it’s important to understand the underlying principles in order to be prepared to deal with any potential problems.

I also talked in a separate article about the very specific problem of configuring ProGuard for an Instant App build.

In this part, I’d like to talk about the practical examples of ProGuard rules on a medium sized sample app: Plaid by Nick Butcher. …


Update 2018–05–23:
As of
Android Plugin for Gradle 3.2 Canary 15 the workarounds for Instant App builds described in this article are not required.
The build now correctly uses code from all modules for the Proguard steps and then redistributes them back to the feature APKs.

Consider the rest of this article deprecated if you’re using at least 3.2.0-alpha15

Instant Apps and the 4 Megabyte limit

Converting an existing app project into an Android Instant App can be challenging, but it is also a great exercise in modularizing and structuring your project, updating SDKs, and complying with all of the Instant Apps sandbox restrictions that were put in place to keep Instant Apps secure and loading fast. …


Why ProGuard?

ProGuard is a tool that shrinks, optimizes and obfuscates code. While there are other tools available for developers, ProGuard is readily available as part of the Android Gradle build process and ships with the SDK.

There are many reasons why you might want to enable ProGuard when building your app. Some developers care about the obfuscation part more, but for me the main benefit is the removal of all unused code that you otherwise ship with your APK as part of the classes.dex file.

Image for post
Image for post
An example size distribution chart of an Android app. Data source: Topeka sample app.

There are many tangible benefits of making your code size (and app) smaller, such as increased user retention and satisfaction, faster download and install times, and reaching users on lower-end devices, especially in emerging markets. There are even some situations when you are required to limit your app size, such as the 4MB limit for Instant Apps, for which ProGuard can prove to be indispensable. …


Image for post
Image for post

New: support for File-by-File updates in the APK patch size estimator

Reducing APK size has been a hot topic during the past year. There are a lot of reasons why: whether you’re Building for Billions to reach users with less capable devices on costly and unreliable networks or you’re just trying to optimize your app, everyone benefits from smaller APK sizes, faster downloads and shorter install times.

There are different costs related to the size of your app:

  • Size of the file you upload to Google Play (raw APK Size)
  • Initial download size
  • On-device install size
  • Update download size

We released a lot of guides explaining how to reduce the initial and on-device APK sizes, including new documentation pages, my I/O talk and articles, which explain how to optimize resources, shrink code and tailor the delivery of your APKs to users’ devices using techniques such as Multi APK. …

About

Wojtek Kaliciński

Android Developer Advocate @ Google

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store