Android Developers Blog

Since our public launch at Google
I/O this year, we've been hard at work expanding the number of supported
devices and the availability of instant apps, so that users can run your apps
instantly, without installation. We're excited to announce that 500 million
Android users now have access to instant apps across countries where Google Play
operates.

A number of Google Play apps and games businesses across a range of industries
have already started building with instant apps. Following the launch of their
instant apps, they have seen strong results in engagement, acquisition and
retention.

Vimeo:WIth more than 50M creators and 240M viewers worldwide, Vimeo has built
a platform whereby people can easily share videos with friends. The company
wanted to implement Android Instant Apps to enable their audience to easily
immerse themselves in content through a native app experience. Vimeo
increased session duration by 130% with their instant app. Discover
how Vimeo drove increased engagement with their instant app.

Jet:
Based in the US, Jet provides a shopping platform, using a real-time savings
engine to surface opportunities for customers to pay less. The company wanted to
expand the reach of their existing app, and updated their app in order to
support instant apps. Following the launch of their instant app, Jet found that
their conversion rate increased by 27%. Learn about
how Jet launched their instant app.

NYTimes
Crosswords: The NYTimes Crosswords instant app provides users with
crossword puzzles as printed in the New York Times daily newspaper. Their aim
was to create a more native experience for their audience, increasing app
engagement. Instant apps have 2x the number of sessions per
user. Based on early results, they are also seeing more effective
acquisition, conversion, and long term retention. Learn more about how NYTimes
increased app sessions.

dotloop:
dotloop is a real estate transaction platform which makes it easier for real
estate professionals to interact with home buyers and sellers, and for them to
be able to sign documents anytime, anywhere. Their aim for instant apps was to
provide more users a native app experience for the signing process of documents.
dotloop increased their key metric with a 62% increase in users who sign
a document. Discover how dotloop supported Android Instant Apps and
increased engagement.

Posted by Maru Ahues Bouza, Developer Relations Partner, Google Play
Android Instant Apps provides rich, native experiences at the tap of a web link.
People can experience your app without upfront installation, enabling a higher
level and quality of engagement.
However, to provide comparable latency of loading a mobile webpage, an instant
app needs to be lean and well structured, so it can be downloaded and run
quickly in response to a URL tap. In light of that, we encourage that the binary
loaded in response any entry-point URL is as small as possible, with a maximum
of 4MB. The smaller the binaries, the faster the instant app will load and the
smoother the user experience.
This document will propose best practices for managing the application structure
and binary size to enable a smooth instant app experience. These practices will
also benefit your installable app.

Refactoring your codebase

The biggest binary size benefit comes from refactoring your app into multiple
feature modules. Even if your current size and feature set don't require
multiple features, we recommend designing for it, so you can quickly add more
features in the future without affecting the binary size of existing features.
We also highly recommend having a unified modular codebase to produce both
installable and instant application binaries, as this will reduce the burden of
maintaining separate projects and code and provide a cleaner project structure
across both. Based on the experience of our early access partners, we believe
this will have the largest impact to the binary size at download. However, it
also requires the most investment.
To get to that end, you can start with a single (base) module and then refactor
code by moving relevant portions to feature module(s). Note that you do not need
to worry about the binary size while developing your instant app, as the size
limit does not apply for locally built binaries. You can also publish your
binary through the Play Developers Console to the Development
track (special track for quick deployment of your instant app during
development), where the size limit is 10MB. [1,
2]
The 4MB restriction is applied once your binary graduate out of the Development
track.
Each feature module can have one (or more) entry points – activities – that
correspond to a given URL. When splitting a single code base into multiple
modules, you will have different entry points for different features, and the
platform will load the relevant feature as needed. Remember, the total binary to
be downloaded for any given entry point should be under 4MB, so the combined
size of any feature module and the base module must be below 4MB.

It is advised to define the feature–activity–entry point mappings first, and
then structure the refactoring effort towards reducing the binary size for each
entrypoint..
Also consider how your libraries are included. If a specific feature module
requires certain libraries they should be included in the feature module only,
instead of being added in the base APK. This will reduce the size of the base
module. For example, let's say you have an application that depends on libraries
X, Y, and Z. Initially, you may pack all the libraries in the base module by
placing all the dependencies in the base gradle.build file. But if only the code
in the feature module requires library Z, it makes sense to move that dependency
from the base module to the feature module.This works as long as no other
feature modules depend on the same library. If multiple feature modules use the
same library it definitely makes sense to keep it in the base module.

Lint checks

Many apps tend to acquire a lot of resources, and over a period of time, some of
them are no longer used. Android Studio has useful built in lint check for
unused resources. Press Alt+Ctrl+Shift+I (Cmd+Alt+Shift+I on Mac OS), type
"unused resources" and start "Unused resources Android|Lint|Performance"
inspection. It helps to reduce the size of the installable APK as well.

String resources

Similar to resources, pay attention to strings, not all of them may be in use,
and typically the application size can be reduced significantly by removing
unused string resources. If application supports multiple languages, you may
want to reduce the number of localized resources, as it typically removes large
chunks of the resources assets. This is especially important if the app supports
only a few languages but uses AppCompat library, which includes messages in
multiple languages. Use resConfig
to select specific resources configurations only. Hint: typically you can use
"auto"
to restrict configurations pulled from third-party libraries to match the set of
configurations defined in your project.

Switch to WebP

Significant reduction of the drawable
resources size may be achieved by switching to WebP
images instead of PNGs. Android Instant Apps supports all features of the
WebP format (transparency, lossless, etc.) so there will be no loss in
functionality. Keep in mind that application launcher icons must use PNG format,
but it should not be a problem since projects normally keep those in mipmap-
directories. If a backward compatible solution is required, you need to include
the original PNG images in the APK module and it will override
WebP resources automatically (main source set overrides all resources from
AAR/feature module). [4]

Of course, going with vector drawables may let you save even more of the
precious space, but using vector drawables will require a code change while the
above mentioned trick with WebP images for the instant app and PNG images for
the installable APK requires no code modifications.

Download assets at runtime

Finally, remember that technically there is no need to pack all the resources in
the instant app APKs, as the application can download additional assets at run
time. This approach also enables the app to download the required assets only.
These modifications may require significant changes to the code base, but will
also help you to reduce the size of the installable APK.
If shrinking resources does not bring your app feature modules size under the
limit, it is time to look for the ways to reduce the code size.

Review native libraries

Some third-party libraries may include native code, which may not be used in the
instant app at all. So the first step is to review the native libraries packaged
within the APK and make sure the instant app has only those that are actually
used. Remember to look into the compiled APK using APK
Analyzer (Build -> APK Analyzer…) [5]

Review external libraries

Next review the list of all external libraries linked with the app's code. You
may find some unexpected surprises courtesy of transitive dependencies.
Transitive dependencies occur when the library your project relies upon depends
on another library, which in turn may depend on yet another library. Sometimes
those transitive dependencies may contain unexpected surprises such as libraries
you do not need at all (i.e. a JSON processing library you never use in your
code.) Please see "Excluding
transitive dependencies" section in the Gradle User Guide for further
details.
Android Studio has several useful tools for analyzing the external dependencies
for the project. It always helps to start with the Project view:

The "Project" view shows a section called "External libraries", where you can
see all the libraries used by the project including any transitive dependencies:

In order to further reduce the base feature size you may need to pay attention
to the code dependencies and external libraries. Check the "Project" view and
look for unused libraries that might be transitive dependencies the project does
not need. Also look for libraries that provide the same functionality (e.g.
multiple libraries for image loading/caching). [4]
You can also compare different builds with APK
Analyzer tool, and it works with instant APKs, too.

Finally, review the list of transitive dependencies and exclude the ones you do
not need. Use the following command to review the dependencies graph:
gradle -q :MODULE:dependencies --configuration compile. Further
details can be found in the Gradle
documentation.

Other tips

Android Studio 3.0 includes the App Links Assistant tool, which can help to
generate the necessary intent filters, and help in splitting the project into
several modules. [3]

Once you got the instant app bundles under the size limit, it is the time to
make sure the building process is up to date. Check that the application package
and instant app APKs are signed using the "APK
Signature Scheme v2". If you sign the APKs using the latest version of the
SDK tools, everything should be done automatically. However, if you manually
sign the build artifacts you need to avoid using jarsigner and switch to apksigner
instead.
And a few useful tips for adapting the app's code to the instant runtime
environment. Keep in mind that having a small branches of code for
instant/installable applications, based on the InstantApps.isInstantApp(...),
should be fine and typically does not make the source code unreadable (unless
you abuse it, of course). Also, when using share intents make sure the code does
not explicitly enumerate applications installed on the device, instant app
security model does not allow that. Simply use regular Intent.createChooser() to
present the list of all possible actions to the user.
The level of effort of developing an instant app for an existing Android
application varies across developers and is heavily dependent on how your
application is organized today. For some, it will be easy as your project is
already organized as multiple modules. However, for some, the focus will be on
reducing the code and resource assets size, and we have introduced tools and
Android platform features above to help you with that.

Hear from other developers using Android Instant Apps

Finally, check out these great posts by developers that have already built an
instant app:

Based in the UK, Playdemic
is a free-to-play mobile games developer. Their leading game Golf
Clash is designed to provide a short and fun, competitive experience. It
uses a simple and accessible game mechanics based on one-thumb gaming which has
generated substantial user engagement, with an average of 44 minutes played over
three sessions a day. Golf Clash is now played by more than 1.5 million players
every day whilst the average revenue per user is equal to other platforms.

Watch Paul Gouge, CEO & Co-founder, and Gareth Jones, Head of Production,
discuss how Playdemic uses live game operations ("live ops") to continuously
engage players and grow their business on Google Play. Live ops are also
referred to as "running games as a service"; they include the strategic
distribution of content and interactions with players that are limited in time
and are designed to increase engagement and monetization.

Watch more developer stories and learn about other features and best practices
you can use to succeed on Google Play with the updated Playbook
app.

Subscriptions can be a sustainable source of revenue, allowing you to invest in
your long-term business growth with confidence. Subscription apps are growing
rapidly on Google Play; the number of subscribers doubled in the last year and
spend on subscriptions has increased 10-times over the past three years. To help
the growing number of subscription businesses we're seeing, we introduced the subscriptions
dashboard in the Google Play Console at I/O 2017. Today, we're adding three
new subscription reports covering acquisition, retention, and cancellations to
help you understand your data and make informed business decisions. Find
information below on the new features, our updated best practices to help you
grow your subscriptions business, and stories from other developers succeeding
on Google Play.

New subscription reports now available in the Google Play
Console

Three new subscription reports in the Google Play Console

The acquisition report enables you to evaluate different
acquisition channels, including Adwords and UTM-tagged campaigns. This can help
you identify which channels and campaigns are the most successful in acquiring
new subscribers.

The retention report displays the lifetime retention of a
customized cohort of your subscribers. It allows you to easily compare different
subscription products, plots key events such as the end of a free trial, and
provides forecasts to enable you to make decisions faster.

Finally, the cancellations report. This detailed cancellation
data shows when a user cancels, either voluntarily (such as when they choose to
cancel) or involuntarily (for example, when there is payment failure). You can
also see whether the cancellation was accompanied by the person uninstalling.

We're continually working to improve the Google Play Console. If you have ideas
or feedback on how we can improve the subscriptions features, please
let us know.

Take advantage of the new Google Play Billing Library

To benefit from these features, you need to be using Google Play Billing as the
payment method for subscriptions in your app. Implementing Play Billing is easy
with the new
Google Play Billing Library. We've also updated Play Billing so the
billing permission will be enforced when the buyer tries to initiate a purchase
rather than when you publish your app. This means you can publish a single APK
in both Play Billing supported and non-supported countries (rather than
maintaining a separate APK that does not use the Billing permission for
non-supported countries). Remember to check
first if billing is supported before trying to offer any in-app purchases.

Become a 'subscriptions first' company and succeed on Google Play

As developers become more sophisticated with their subscriptions offerings on
Google Play, our most successful partners have learned a lot about what does and
doesn't work well. Niko Schröer, a partner manager with expert knowledge of
subscription apps, has a new post on Medium to help you become
a successful subscriptions company. In the post, you'll find a link
to our detailed user
research on Android subscribers [PDF] published in June 2017, which offers
helpful insights into what users look for in a subscription product. We've also
published some new
best practices on subscriptions, which you can read along with other tips to
succeed on Google Play in the Playbook
app.

How other developers are succeeding with subscriptions on Play

Viki, a Singapore based video app, uses subscriptions to build
a sustainable and predictable revenue stream, allowing them to invest in
original content and provide better premium experiences for their users. Total
revenue from subscriptions grew over 200% over the year, and by 700% in emerging
markets like the Middle East and Latin America. Watch Alex Chan, Senior VP of
Product and Engineering at Viki, tell the story.

The developer of Anghami, a popular music service in the Middle
East and North Africa, increased the number of subscribers in their app with
user interface experiments and introductory
pricing. During one promotional period, Anghami used introductory pricing to
increase new sign-ups by 400% compared to their average daily sign-ups. Find out
more about how
Anghami achieves subscription success.

Android developers know that dex compilation is a key step in building an APK.
This is the process of transforming .class bytecode into .dex bytecode for the
Android Runtime (or Dalvik, for older versions of Android). The dex compiler
mostly works under the hood in your day-to-day app development, but it directly
impacts your app's build time, .dex file size, and runtime performance.

That's why we are investing in making important improvements in the dex
compiler. We're excited to announce that the next-generation dex compiler, D8,
is now available for preview as part of Android Studio
3.0 Beta release.

When comparing with the current DX compiler, D8 compiles faster and outputs
smaller .dex files, while having the same or better app runtime performance.

How to try it?

D8 is available for your preview starting with Android Studio
3.0 Beta. To try it, set the following in your project's gradle.properties
file:

android.enableD8=true

We have tested D8's correctness and performance on a number of apps, and the
results are encouraging. We're confident enough with the results that we are switching to use D8 as the default dex compiler for building AOSP. There are currently no known
issues, but we would love to hear your feedback. You can file a bug report using
this
link.

What's next?

We plan to preview D8 over the next several months with the Android Studio 3.0
release. During this time, we will focus on addressing any critical bug reports
we receive from the community. We plan to bring D8 out of preview and enable it
as the default dex compiler in Android Studio 3.1. At that time, the DX compiler
will officially be put in maintenance mode. Only critical issues with DX will be
fixed moving forward.

Beyond D8, we are also working on R8, which is a Proguard replacement for whole
program minification and optimization. While the R8 project has already been open sourced, it has not yet been
integrated with the Android Gradle plugin. We will provide more details about R8
in the near future when we are ready to preview it with the community.

Tool developers: get your bytecode tools Java 8 ready

In April, we announced
Java 8 language features with desugaring. The desugaring step currently
happens immediately after Java compilation (javac) and before any bytecode
reading or rewriting tools are run. Over the next couple of months, the desugar
step will move to a later stage in the pipeline, as part of D8. This will allow
us to further reduce the overall build time and produce more optimized code.
This change means that any bytecode reading or rewriting tools will run before
the desugar step. If you develop .class bytecode reading or rewriting tools for
Android, you will need to make sure they can handle the Java 8 bytecode format
so they can continue to work properly when we move desugaring into D8.

Today, we're releasing Developer Preview 5 (DP5) of Android Things, which
includes the major change of being based on the upcoming Android O release.
Android Things is Google's platform to enable Android Developers to create
Internet of Things (IoT) devices, and seamlessly scale from prototype to
production.

Android O

Android O is currently under Developer
Preview for phones and tablets, and DP5 is now based on this upcoming
release (previous releases were based on Android N). This means that your future
Android Things applications should target API 26 to work correctly on the
platform with our support libraries.

Hardware Changes

DP5 now adds support for the new NXP SprIoT
i.MX6UL design, as listed in our developer kits documentation.
With Intel discontinuing the Edison and Joule hardware
designs, these platforms are moving to legacy support. They will not continue to
receive the latest platform updates, but developers may continue to access the
DP4.1 system images from the Android Things Console.

An important goal of Android Things is to help developers seamlessly scale from
prototype to production. When we exit Developer Preview, we will differentiate
between hardware platforms targeted for prototyping-only and hardware reference
designs that can scale to production. Production-ready hardware will satisfy
Google's security requirements and include long term support from the silicon
manufacturers. We will have more to share later on.

Improvements

With the move to the Android O codebase, there are new API features from Android
as well as specific features for Android Things. For those developers using
UserDriver APIs, you will need to add new permissions to your
AndroidManifest.xml. The documentation
contains details about the permissions needed for each driver type. DP5 also now
supports OpenGL ES 2.0 and WebView on the Raspberry Pi 3, which was a highly
requested feature from developers. We have also implemented dynamic
pin muxing for the Raspberry Pi 3, with pins being configured at runtime
depending on what features are being used.

Android Studio

The samples for Android Things are now available directly in Android Studio for
browsing and importing. You can now go to File, New, Import Samples, and search
for Things to see everything that is available. We have a wide range of samples,
demonstrating how to interact with buttons, sensors, LEDs, and displays, as well
as implementing Google Assistant and TensorFlow.

Android Things Console

We recently launched
the Android Things
Console, which provides the ability to support over-the-air updates (OTA) to
Android Things devices. We have recently made a number of UX improvements to the
console to improve usability and functionality. DP5 is now available within the
Android Things Console, but the DP5 update will not be pushed automatically to
devices without your intervention. You will need to update your application for
DP5, then create a new update and push it via the console yourself.

For many international developers Russia is considered to be an opportunity to
grow their app or games business. According to the 2017 report on the 'Mobile
Internet Economy in Russia [PDF]', Russia's population is young with 45% of
people being under 35 years old.1
The report also found that mobile subscriptions are at 160% of the population of
146 million people, meaning people with data plans have more than one on average
– considerably higher than other well connected countries.2
Last year Android accounted for 84% of all smartphones in Russia and smartphone
shipments are still growing with demand up 11% in early 2017 compared to 2016.

Russian people are very engaged in terms of smartphone mobile usage, Russia is
one of the top countries in terms of apps downloaded per person3.
Half of the population are gamers; their favorite game genres being strategy,
builders and farms, shooters, puzzles and fighters. The most popular app
categories are dating (with strong local developers), music & video, social &
messaging and shopping.4

Tips to help you successfully localize for Russian

Along with understanding Russian mobile trends, there are market specific best
practices which can help you tailor your apps and games for a local audience to
increase your chance of business success.

Language localization

Proofread and quality assure your entire app or game after translating text
resources and visual assets. After localization, you should quality assure your
app or game as a whole and not just text resources.

Use proficient native speakers. Contextually relevant translations are best
done by native speakers familiar with mobile apps or games terminology.

Localize all content where possible. Aim to provide as much localized
content as possible, providing a similar level in the local language as the
original.

Ensure consistent language and style. Semantically check the translated
text in the context of the whole app/game experience to make it look and sound
relevant to local users. Ensure use of consistent language style (such as
formal/informal addressing) and use of the same terms or names across all the
text and visual assets.

Don't forget language rules. Follow language rules on
quantities, gender, word breaking, acronyms, etc. If the user gender is unknown,
consider making a careful choice of words so that to omit specifying user's
gender or use a passive voice.

Be aware of the length of translated text. In Cyrillic languages words and
phrases tend to be longer than English, and might not fit into a tightly
designed UI. Be creative in finding alternative contextually and locally
relevant alternative translations.

Take note of the "you" translation. "You" translation is contextual and can
be translated to singular (similar to early modern english thou) or
plural form (when refer to multiple people or in polite form). And as a
reminder, when choosing to address your user informally ("thou"), make sure to
avoid specifying user's gender, unless it is known.

Play Store assets

Provide localized store assets, such as the title (for example when title
is not a universally known brand), store listing, screenshots and videos. Do not
forget to localize the "what's new" section if included.

Avoid keywords in your app or game title which attempt to improve its
visibility on the Play Store.

Local pricing, price points, rounding rules

Avoid adding your own currency indicators (such as $ or £) as some markets
use local pricing -
find out more about local pricing. Use the Russian Ruble official symbol (₽)
after the number with a space, and use comma as a decimal separator, e.g. 49,99
₽.

Generally, in-app, subscriptions, or paid app/games prices should be lower
than in Western markets. Research industry best practices and experiment which
price points are best for your app or game business model.