Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[Devfest] Optimize your Apps for Android (Go ed...

[Devfest] Optimize your Apps for Android (Go edition)

Android (Go edition) is a mobile operating system built for entry-level smartphones with less RAM. It runs lighter and saves data, enabling OEMs to build affordable and reliable smartphones.

Considering the big OEMs like Jio, Samsung, Oppo, Realme etc. building Android (Go edition) devices, the user base for the apps running on Go devices is increasing exponentially. If the user experience is not catered, your app business is going to be directly affected. So, there is a need for developers to build apps that perform well on these devices and provide users a smooth app experience.

But the markets with the fast growing internet and smartphone penetration can have some challenging issues, such as:

1. Your app is not starting within the required time limit.

2. A lot of features/required capabilities increases your app size

3. How to handle memory pressure while working on Go apps?

To help your app succeed and deliver the best possible experience in developing markets, In this session, I will talk about considerations that developers should keep in mind when adapting their apps to work well on Go devices. Not only do these best practices work for Go but all the Android devices across different versions and memory ranges (low/mid/high-end devices).

Niharika Arora

October 18, 2022
Tweet

More Decks by Niharika Arora

Other Decks in Technology

Transcript

  1. Agenda 1. Android Go: What & Why? 2. Why build

    for Android Go? 3. Optimize app memory,startup time and app size 4. Tools 5. Final Words…
  2. What is Android Go? A mobile operating system built for

    entry-level smartphones with less RAM than standard in higher-end devices.
  3. What is Android Go? A mobile operating system built for

    entry-level smartphones with less RAM than standard in higher-end devices. Release Android 8.1 (API level 27) Android 9 (API level 28) Android 10 (API level 29) Android 11 (API level 30) Android 12 (API level 31) Android 13 (API level 33) Min RAM 512MB 512MB 512MB 1GB 1GB 2GB
  4. Why build for Android Go? 1. >200mn people actively use

    Android(Go edition) phones worldwide.
  5. Why build for Android Go? 1. >200mn people actively use

    Android(Go edition) phones worldwide. 2. Big OEMs like Jio, Samsung, Oppo etc. building more Go devices.
  6. Why build for Android Go? 1. >200mn people actively use

    Android(Go edition) phones worldwide. 2. Big OEMs like Jio, Samsung, Oppo etc. building more Go devices. 3. Not catering these devices -> no smooth user experience -> impact on business directly
  7. KPI Category App Startup Latency Common to all apps App

    Crash Rate Common to all apps End to end latency for Camera Shot Specific to Camera app App Not Responding Rate Common to all apps Phases Description Define • Before starting any optimization effort, define your Key Performance Indicators (KPIs).
  8. Phases Description Define • Before starting any optimization effort, define

    your Key Performance Indicators (KPIs). Breakdown • Break down a given KPI into individual signal metrics. App Crash Rate Crash due to unhandled errors Crash due to high memory usage → Crash due to ANR etc.
  9. Phases Description Define • Before starting any optimization effort, define

    your Key Performance Indicators (KPIs). Breakdown • Break down a given KPI into individual signal metrics. Benchmark • Benchmark/measure the KPI values and individual metrics to identify current performance.
  10. Phases Description Define • Before starting any optimization effort, define

    your Key Performance Indicators (KPIs). Breakdown • Break down a given KPI into individual signal metrics. Benchmark • Benchmark/measure the KPI values and individual metrics to identify current performance. Repeat the process • Repeat the process if your target is not met!!!!!!!!
  11. Phases Description Define • Before starting any optimization effort, define

    your Key Performance Indicators (KPIs). Breakdown • Break down a given KPI into individual signal metrics. Benchmark • Benchmark/measure the KPI values and individual metrics to identify current performance. Repeat the process • Repeat the process if your target is not met!!!!!!!! Add regular regression test • Decide on how often tests should run? • What should be the optimal frequency for your app?
  12. Optimize App Memory 1. Schedule tasks which require similar resources(CPU,

    IO, Memory) appropriately. 2. Release unneeded memory in onTrimMemory().
  13. Optimize App Memory 1. Schedule tasks which require similar resources(CPU,

    IO, Memory) appropriately. 2. Release unneeded memory in onTrimMemory(). 3. Find & fix memory leaks.
  14. Optimize App Memory 1. Schedule tasks which require similar resources(CPU,

    IO, Memory) appropriately. 2. Release cache-like memory in onTrimMemory(). 3. Find & fix memory leaks. 4. Optimize your bitmaps.
  15. Optimize Startup time 1. Move the tasks from UI thread

    to background thread. 2. Avoid eager initialization.
  16. Optimize Startup time 1. Move the tasks from UI thread

    to background thread. 2. Avoid eager initialization. 3. Analyze and fix disk read contention.
  17. Optimize Startup time 1. Move the tasks from UI thread

    to background thread. 2. Avoid eager initialization. 3. Analyze and fix disk read contention. 4. Avoid synchronous IPCs on UI thread.
  18. Optimize App size 1. Remove unnecessary layouts. 2. Migrate to

    dynamic layouts/views when appropriate.
  19. Optimize App size 1. Remove unnecessary layouts. 2. Migrate to

    dynamic layouts/views when appropriate. 3. Revaluate features with low DAU. Try to disable features which take more memory and make the app less performant.
  20. Optimize App size 1. Remove unnecessary layouts. 2. Migrate to

    dynamic layouts/views when appropriate. 3. Revaluate features with low DAU. Try to disable features which take more memory and make the app less performant. 4. Try to reduce dalvik code size.
  21. Optimize App size 1. Remove unnecessary layouts. 2. Migrate to

    dynamic layouts/views when appropriate. 3. Revaluate features with low DAU. Try to disable features which take more memory and make the app less performant. 4. Try to reduce dalvik code size. 5. Upload your app with Android app bundles and utilize dynamic delivery feature if applicable.
  22. Memory • Debug Memory usage using Perfetto • Utilize meminfo

    : adb shell dumpsys meminfo <package_name|pid> [-d] • Detailed analysis using showmap : adb shell showmap <process id> • Use Address Sanitizer to detect memory errors in C/C++ code • Inspect your memory usage using Memory Profiler
  23. App Startup • Debug CPU usage, frame rendering time and

    thready activity using Perfetto • Streamline startup sequences and explicitly set the order of initialization using App Startup library. • Utilize Baseline Profiles. • Combine and effectively use Debug API + CPU Profiler. • Write tests and measure scrolling/animation rendering time using Macrobenchmark.
  24. App Size • Use Android Studio Analyzer. • Remove unused

    resources using Lint. • Crunch PNG files using aapt tool.
  25. Resources • Android Go Developer Documentation: What, Why and how

    to develop apps following standard best practices. • Optimize your app for Android : Lessons from Google apps Part-1 • Optimize your app for Android : Lessons from Google apps Part-2
  26. Conclusion 1. Android Go is not just “INDIA” specific. 2.

    Improving performance on Android Go (low-end) devices ∝ Improve performance on all (mid & high-end) devices too. 3. Keeping your users happy should be your first priority.
  27. “Building an app is easy, but building an efficient one

    for everyone is, what we really require.”