Sunday, December 4, 2022
HomeAndroidOptimize Android for Android (Go edition). Lessons learned from Google apps Part...

Optimize Android for Android (Go edition). Lessons learned from Google apps Part 1.

Published by Niharika AroraDeveloper Relations Engineer

MAD%20App%20Architecture%20launch%20 %20header%20(2)

The Android Operating system gives everyone the ability to access computing’s power. All users can see this vision, even those with entry-level smartphones that are subject to real limitations in terms of data storage and memory.
It was particularly important because we had just announced our first announcement. Android (Go Edition) In 2017, low-end devices accounted for 57% global smartphone shipments (IDC mobile phone tracker).

What does it mean? Android (Go edition)?

Android The mobile operating system (Go edition), is designed for smartphones starting at entry level with less RAM. Android The Go edition runs faster and uses less data. This allows Original Equipment Manufacturers to create affordable entry-level devices that give people the possibility of a better life. For more information, see the list below. Android (Go edition) device capability specifications, see this page on our site.









Android 8

Android 9

Android 10

Android 11

Android 12

Android 13

Mini RAM







Most Recent Updates

Smartphones are continually being developed by us. Android (Go edition) more accessible with additional performance optimizations and features designed specifically for new & novice internet users, like translation, app switching, and data saving.

Here are some of the most recent changes we made to our website. Android 12:

Accelerated App Launches

Batteries last longer 

Easier App Sharing 

You can take more control of your privacy

Why should you build? Android (Go edition)?

With the fast growing & easily accessible internet, and all the features available at low cost, OEMs and developers are aiming & building their apps specifically for Android (Go edition) devices.

Fast forward to today — many people worldwide actively use an Android (Go edition) phone. Consider the big OEMs Like Jio Samsung, Oppo, Realme etc. Building Android (Go edition) devices, there is a need for developers to build apps that Perform well Particularly on the Go device.

The markets that have high levels of smartphone penetration and fast internet access can face challenges, like:

  • It isn’t starting in the specified time.
  • Your app’s size will increase if you add many required capabilities or features. 
  • What can you do to manage memory pressure when working with Go apps?

Optimize apps to maximize their effectiveness Android (Go edition)

To help your app succeed and deliver the best possible experience in developing markets, we have put together some best practices based on experience building our own Google apps Gboard & Camera from Google.




Define Before starting any optimization effort, it’s important to define the goals. For the app, key performance indicators (KPIs), must be identified.

  • You can have KPIs that are shared across multiple applications, or you can make them very specific. Here are some examples of KPIs.  
KPI Categories
App Startup Latency All apps can use the same common features
App Crash Rate All apps can use the same common features
End to end latency for the CUJ-Camera Shot Camera app
App Not Responding Rate All apps can use the same common features
  • The team needs to agree on target thresholds once KPIs have been defined. This can be derived from the minimum user experience/benchmarks in mind.
  • Ideal KPIs should be developed from the viewpoint of User Experience and technical complexity.
Broken The next step could be to separate a KPI into signals metrics.

  • For example → End to end latency for CUJ (shots in Camera) can be divided into → Frame capture latency, image processing latency, time spent on saving a processed image to disk etc.
  • Similarly, App Crash Rate can be bucketed into → Crash due to unhandled errors, Crash due to high memory usage, Crash due to ANR etc.
Benchmark You can benchmark the KPI value and measure individual metrics in order to determine your current performance.
Things are going well if KPI targets have been met. If not → identify the bottlenecks by looking at the individual breakdowns.
Keep going with the same process.

You can optimize a particular bottleneck by benchmarking the metrics once again. If so, you will be able to determine if your KPI targets have been met. Continue the process, if not. Great job!
Regression tests can be added regularly This either runs every time a change is made or it will run periodically to detect regressions in KPIs. Debugging and finding bugs is much easier than not allowing them in the codebase. Don’t allow the changes that fail the KPI goals unless the decision is to update the KPI targets.

  • You can invest early in building a regression framework to address such problems.
  • How often should tests be run? How often should you run tests?

Optimize App Memory

  • onTrimMemory can release cache-like memory(): TrimMemory() An app can use ActivityManager.getMyMemoryState(RunningAppProcessInfo) to reduce unnecessary memory. To best know an app’s current trim level, you can use ActivityManager.getMyMemoryState(RunningAppProcessInfo) and then try to optimize/trim the resources which are not needed.

GBoard utilized the onTrimMemory() It will signal that unneeded memory is being cut while the process runs in the background. This happens when there is not enough RAM to allow background processes to run properly. This helped to decrease the frequency of being low-memory killed, and also the average background RSS. Your app’s resident set size (RSS), is the memory that is occupied by it. It is not part of main memory, but is a subset. You can read more about RSS by clicking here. 

  • Check if malloc can be replaced with mmap when accessing read-only & large files: Mmap can only be used to read large files onto memory. There are some kernel optimizations that can be used to read-only memory mapped file files. These include unloading pages not being used.

This is often useful to load large assets and ML models.

  • It is important to plan tasks that require the same resources (CPU, IIO, Memory) in a way that works well. Multiple memory-intensive operations could be running simultaneously, which can lead to overcrowding and a higher peak memory consumption. The Camera from Google app found multiple problems, ensured a cap to peak memory and further optimized their app by appropriately allocating resources, separating tasks into CPU intensive, low latency tasks(tasks that need to be finished fast for Good UX) & IO tasks. Tasks should be scheduled in the right thread pools/executors so that they run in balanced ways on limited resources.
  • Find & fix memory leaks: Although it is hard to fight leaks, there are some tools that can help. Android Studio Memory Profiler/Perfetto are specifically made to help you find and fix memory problems quickly.

Google apps made use of tools to detect and correct memory issues, which allowed for a lower memory footprint. This allowed the other parts of the app run with no additional memory stress.

This article is about Take this example From Gboard App is about See leaks

Caching subviews like this is one example. 


void onKeyboardViewCreated(View keyboardView) {
  This.keyButtonA = keyboardView.findViewById(…);

It is possible that the [keyboardView] will be released in the future. To prevent the view from leaking, it would be a good idea to assign the null value for the keyButtonA at this time.|keyboardView| might be released at some time, and the |keyButtonA| should be assigned as null appropriately at some time to avoid the view leak.

Lessons learned:

    • After analysing and validating the impacts, it is important to update frameworks/library regularly.
    • Be sure to free memory before you allocate new values to pointers pointing at other objects in Java heap. (native backend java objects) 

You can take this example as an illustration:

It should be possible to do this in Java


ClassA obj = New KlassA(“x”);
obj = New ClassB(“y”);


This issue should be resolved by GC.


If KlassA The system allocates resources natively below, and it doesn’t automatically cleanup. finalize(..) Caller must call to make this happen release(..)  It should look like this: 


ClassA Obj = ClassA (New)“x”);

// Explicit cleanup.

obj = new classB(“y”);


It will happen otherwise Leakage Memory from the native heap 

  • Optimize bitmaps Apps that have large images/drawables tend to use more memory. Google apps have optimized large bitmaps used within their apps. 

Lessons learned :

    • You prefer lazy/on-demand initializations for large drawables.
    • When necessary, release view
    • If possible, don’t use full-color bitmaps. 

Here’s an example: Gboard’s glide typing feature needs to show an overlay view with a bitmap of trails, which can only has the alpha channel and apply a color filter for rendering.


// Create the trail bitmap

trailBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ALPHA_8);

// Prepare paint to be used on trails

trailPaint.setColorFilter(new ColorMatrixColorFilter(new ColorMatrix(new FloatProtected void onDraw (Canvas canvas).if (trailBitmap = null)[] {

  0, 0, 0, 0, (color >> 16) & 0xFF,

  0, 0, 0, 0, (color >> 8) & 0xFF,

  0, 0, 0, 0, color & 0xFF,

  0, 0, 0, 1, 0


// onDraw


protected void onDraw(Canvas canvas) {


  if (trailBitmap != null) {

    canvas.drawBitmap(trailBitmap, 0, 0, trailPaint);



Gboard: A screen shot of glide typing

  • Make sure to only adjust the alpha channel of the bitmap in complex views. It saved them several MBs, per screen size/density.
  • Glide can be used to: 
    • ARGB_8888 has 4 bytes/pixel while RGB_565 consumes 2 bytes/pixel. While the memory footprint is reduced to half when RGB_565 formats are used, it has a lower bitmap quality which comes at a higher price. You can adapt your case to meet alpha needs, regardless of whether you require them.
    • Configure and use cache wisely when using a 3P lib like Glide for image rendering.

  • When building an app, consider other GIF options Android (Go edition) as GIFs take a lot of memory.
  • The aapt Tool can optimize image resources that are stored in res/drawable/ during build. It also supports lossless compression. Aapt tools can, for instance, convert true-color PNGs that do not contain more than 256 colours to an 8 bit PNG with a colour palette. The result is an image that has equal quality and a smaller memory footprint. Learn more.
  • PNG files can be reduced without having to compromise image quality with tools such as pngcrush and pngquant. All these tools allow you to reduce PNG file sizes while still maintaining the high quality image.
  • Resizable bitmaps are also available. Draw 9-patch is an editor that supports WYSIWYG. Android Studio lets you create bitmap images, which are automatically resized to suit the content of your view and the screen size. You can learn more about it here. 


This blog discusses why developers should build for. Android (Go edition), a standard approach to follow while optimizing their apps and some recommendations & learnings from Google apps to improve their app memory and appropriately allocate resources.

This blog’s next section will focus on Startup latency, app sizes, and Google apps tools that help identify and resolve performance issues.

  • Optimize Android (Go edition): Lessons from Google apps – Part 1
  • Optimize Android Go : Lessons from Google apps – Part 2
  • Optimize Android Go: Lessons from Google apps – Part 3 (coming soon)

Trending Articles

Continue to the category


Please enter your comment!
Please enter your name here

- Advertisment -spot_img

Most Popular