Tag Archives: AndroidDev

Android Dev Challenge: lift off with Jetpack Compose

Posted by The Jetpack Compose Team

Jetpack Compose is Android’s modern toolkit for building native UI. It enables you to quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs. With the Beta of Jetpack Compose released today, this is the perfect time to learn Compose and get ready to adopt it. To help you get started with Jetpack Compose we are launching a new #AndroidDevChallenge!

For the next four weeks, the #AndroidDevChallenge will be launching a series of weekly challenges to help you build better apps faster with Jetpack Compose. Oriented around “lift off insights," each challenge focuses on a new area of Compose, from animations to Material Theming, composables to lists and more! Compete to win new prizes for each challenge, with over one thousand prizes to win including a Pixel 5. 1 The first challenge starts today!

The challenges

Every week brings a new challenge with its own rules and tasks. Every Wednesday starting today we’ll publish a blog post containing the full description of what you need to do and how long you have to complete the task. Each challenge will help you get familiar with the compose mental model and different Compose APIs - from basic Composables like Text and List, to state, animations and more.

Your solution to each challenge must be implemented in a GitHub repository. Make a copy of this Github repository template and follow the instructions in the README. The template contains a basic Hello World! in Compose and a continuous integration setup.

Week #1 - Puppy adoption app

Android 12 logo

Let’s start the #AndroidDevChallenge with a bang bark: build a puppy adoption app! The app should contain an overview screen that displays a list of puppies, and a detail screen showing each puppy's details. You have until March 2nd, 23:59 PST to submit your entry. 2

Your UI must be fully built in Compose. Your submission will only be judged based on your app’s UI layer. To help you with the implementation, check out the Compose documentation on layouts, lists, text and navigation. For some paws-on learning try out the Compose pathway, with codelabs covering several topics useful in completing this challenge.

Are you a 🐱rather than a 🐶 person? Submissions for any type of pet adoption app are welcomed.

We look forward to seeing what you build!

This week’s prize

Our first challenge kicks off with a prize that makes for the perfect sidekick as you’re flying through Compose: a limited edition trophy of our Jetpack Compose superhero, made of LEGO bricks. The first 500 people to successfully complete this challenge and submit their entry can add this trophy to their collection of Android figurines, showing off how you’re a winner for the first week’s #AndroidDevChallenge.

Week #1 prize: Jetpack Compose superhero

Help make Jetpack Compose better

Community is at the heart of Jetpack Compose and your feedback helps us build a better product:

  • File issues with Jetpack Compose on the official issue tracker.
  • Sign up to be part of the Jetpack Compose research studies.


1 There will be new prizes for each week’s challenge; for weeks when a Google Pixel 5 is a prize, we will offer a similarly valued electronics gift card for winners that reside in a country where a Google Pixel 5 is unavailable. See the official rules for more information.
2 Please review the link for the full official rules associated with the entry.

Android Dev Challenge: lift off with Jetpack Compose

Posted by The Jetpack Compose Team

Jetpack Compose is Android’s modern toolkit for building native UI. It enables you to quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs. With the Beta of Jetpack Compose released today, this is the perfect time to learn Compose and get ready to adopt it. To help you get started with Jetpack Compose we are launching a new #AndroidDevChallenge!

For the next four weeks, the #AndroidDevChallenge will be launching a series of weekly challenges to help you build better apps faster with Jetpack Compose. Oriented around “lift off insights," each challenge focuses on a new area of Compose, from animations to Material Theming, composables to lists and more! Compete to win new prizes for each challenge, with over one thousand prizes to win including a Pixel 5. 1 The first challenge starts today!

The challenges

Every week brings a new challenge with its own rules and tasks. Every Wednesday starting today we’ll publish a blog post containing the full description of what you need to do and how long you have to complete the task. Each challenge will help you get familiar with the compose mental model and different Compose APIs - from basic Composables like Text and List, to state, animations and more.

Your solution to each challenge must be implemented in a GitHub repository. Make a copy of this Github repository template and follow the instructions in the README. The template contains a basic Hello World! in Compose and a continuous integration setup.

Week #1 - Puppy adoption app

Android 12 logo

Let’s start the #AndroidDevChallenge with a bang bark: build a puppy adoption app! The app should contain an overview screen that displays a list of puppies, and a detail screen showing each puppy's details. You have until March 2nd, 23:59 PST to submit your entry. 2

Your UI must be fully built in Compose. Your submission will only be judged based on your app’s UI layer. To help you with the implementation, check out the Compose documentation on layouts, lists, text and navigation. For some paws-on learning try out the Compose pathway, with codelabs covering several topics useful in completing this challenge.

Are you a 🐱rather than a 🐶 person? Submissions for any type of pet adoption app are welcomed.

We look forward to seeing what you build!

This week’s prize

Our first challenge kicks off with a prize that makes for the perfect sidekick as you’re flying through Compose: a limited edition trophy of our Jetpack Compose superhero, made of LEGO bricks. The first 500 people to successfully complete this challenge and submit their entry can add this trophy to their collection of Android figurines, showing off how you’re a winner for the first week’s #AndroidDevChallenge.

Week #1 prize: Jetpack Compose superhero

Help make Jetpack Compose better

Community is at the heart of Jetpack Compose and your feedback helps us build a better product:

  • File issues with Jetpack Compose on the official issue tracker.
  • Sign up to be part of the Jetpack Compose research studies.


1 There will be new prizes for each week’s challenge; for weeks when a Google Pixel 5 is a prize, we will offer a similarly valued electronics gift card for winners that reside in a country where a Google Pixel 5 is unavailable. See the official rules for more information.
2 Please review the link for the full official rules associated with the entry.

Improve Your Game with Texture Compression Format Targeting

Posted by Yafit Becher, Product Manager & Dan Galpin, Developer Advocate

Play Asset Delivery downloads the best supported texture for the device

Google Play Asset Delivery allows you to publish an Android App Bundle to Google Play containing all the resources your game needs. It offers multiple delivery modes, auto-updates, compression, and delta patching, all hosted at no cost to you.

As of today, you can use Google Play Asset Delivery to include textures in multiple texture compression formats in your Android App Bundle and Google Play will automatically deliver the assets with the best supported texture compression format for each device. With Texture Compression Format Targeting, you can start using ASTC for devices that support it while falling back to ETC2/ETC1 to devices that don’t. The Adaptive Scalable Texture Compression (ASTC) format offers advantages, such as improved rendering performance, faster load times, a smaller in-memory footprint, better battery life, and improved visual quality. You can even dramatically reduce your download size and on-device footprint by optimizing the tradeoff between size and quality.

Higher bandwidth version of much of this information

Android App Bundle will be the required publishing format for all new games and apps as of August 2021, which means that Google Play Asset Delivery will be required for new games that want Google Play to host more than 150MB of assets. Texture format targeting provides value even for smaller games due to the advantages of newer texture compression formats.

Texture compression

Texture compression is a form of lossy image compression that allows the GPU to render directly from the compressed texture using specialized silicon blocks, reducing the texture memory and memory bandwidth required to render the texture. As GPUs have gotten more advanced, more sophisticated texture compression formats have been developed, but not all GPUs can take advantage of them.

ASTC was released in 2012 to give developers more flexibility in trading compression size vs image quality. It compresses using fixed 128-bit block sizes, but allows for variable block footprints from 4x4 (8 bits per texel) to 12x12 (.89 bits per texel).

Texture compression format image  Texture compression format image Texture compression format image

Googleplex from Google Earth at 12x12 (.89 BPT), 6x5 (4.27 BPT), 4x4 (8 BPT)

This allows almost any type of texture to be used in compressed form, and allows for textures to occupy much less space in RAM — up to 36x less space compared to uncompressed 2D textures depending on quality. Smaller textures also take less time to load, making games start faster.

Memory bandwidth

Since the GPU needs to do fewer reads from texture memory in order to render the texture, the memory bandwidth required to render the scene is reduced, often substantially when texture caches are taken into account.

Texture compression formats in Android

The top compression formats in Android are ETC1, ETC2, and ASTC.

texture compression image

Top texture compression formats with device penetration as of September 2020

ETC1 is supported on practically all devices. It has no transparency support; games can use a second texture for the alpha component. It has quality issues with sharp transitions such as edges and text.

ETC2 is supported by all devices that support GLES3. It supports multiple transparency modes and improves quality compared to ETC1.

ASTC is a more recent format that's more flexible; it supports many different kinds of textures, allowing for just about any texture in your game to benefit from compression. In addition, it supports various block sizes with different associated compression ratios. Using this format is a good way to optimize the size, image quality, and performance of your game.

Asphalt Xtreme Gameloft image

When experimenting with ASTC on Asphalt Xtreme Gameloft found that they could reduce the size of their game by up to 30%

Using texture compression format targeting

Once you've implemented Google Play Asset Delivery in your game, adding texture format targeting is an incremental step. Inside your asset packs, make sure you have a directory that holds just your textures, such as [assetpackname]/textures. This directory will be used to hold default textures (probably in ETC1 or ETC2 format).

Then, create additional texture directories with a suffix representing the additional formats you wish to support.

[assetpackname]/textures#tcf_etc2
[assetpackname]/textures#tcf_astc

Finally, update your app build.gradle file to enable texture splits in asset packs:

// In the app build.gradle file:
android {
    ...
    bundle {
        texture {
            enableSplit true
        }
    }
}

Google Play strips off the texture suffixes so your game reads its assets from the default directory, regardless of what textures are delivered to the device.

If you're using Unity, our Play Asset Delivery plugin for Unity is ready to create app bundles with texture-targeted packs.

Texture compression format targeting is available now

We're committed to helping you serve your entire game through Play with customized dynamic delivery and features such as texture compression format targeting. Documentation at d.android.com will walk you through the integration process depending on the game engine you use, and we also have codelabs ready for both C/C++ and Unity games. We have more information on all of our game related developer resources at d.android.com/games and stay up to date with Google Play Asset Delivery and other game developer tools by signing up for the games quarterly newsletter.

Android GPU Inspector Open Beta

Posted by Jay Kong, Gaming and Graphics Product Manager

With the rollout of Android 11 on Pixel, Android GPU Inspector (AGI) has graduated from a limited developer preview to an open beta. During the preview, AGI has been helpful in finding performance bottlenecks for developers we've been working with, and we're looking forward to hearing your feedback.

What is Android GPU Inspector?

AGI is a graphics profiling tool that allows you to look into the GPU of Android devices to better understand graphics bottlenecks and optimize the performance of games and apps that leverage 3D graphics APIs. It shows a timeline of events for your running game or app, which includes system activities, high frequency GPU hardware counters, and, if you are using Vulkan, GPU activity information.

Android

What devices can I use it on?

AGI relies on updated firmware and video drivers to get information it needs; the first devices to support it are the Pixel 4 and 4XL running Android 11. While we are working with device manufacturers and SoC vendors to enable more supported devices, the key insight we’ve learned on our journey is that being able to look into the GPU—even on a single device—creates a lot of value.

Working with Blizzard Entertainment Inc. and NetEase, Inc., AGI helped pinpoint 45% vertex bandwidth savings for the upcoming Diablo Immortal, a dark gothic action RPG game.

Diablo:

Diablo: Immortal

Working with King, AGI helped improve GPU frame time from 11-16ms to a stable 8ms for the upcoming Crash Bandicoot: On the Run!, allowing the game to reduce battery drain and run faster for a smoother experience.

Crash Bandicoot: On the Run

Crash Bandicoot: On The Run

In collaboration with Jam City, AGI helped reduce GPU frametime by 45% on World War Doh: Real Time PvP.

World War Doh: Real Time PvP

World War Doh: Real Time PvP

Optimization tutorials

Stay tuned for more information on how to use the tool and address common issues we’ve seen when working with real games. We’ll begin by demonstrating using AGI to indicate optimizations to make in your game’s textures.

You can also read about this topic on Medium, here.

How do I get started?

You can download AGI here, and the setup instructions are here. AGI is in beta, so there will be issues. Check out the release notes, and let us know if you see any issues here.

To learn about new device support, you can check this page. Stay up to date with AGI and all of our game developer tools by signing up for the games quarterly newsletter.

11 Weeks of Android: Games, media, and 5G

Posted by Dan Galpin, Developer Advocate

Android

This blog post is part of a weekly series for #11WeeksOfAndroid. For each of the #11WeeksOfAndroid, we’re diving into key areas so you don’t miss anything. This week, we spotlighted games, media, and 5G; here’s a look at what you should know.

What's the buzz in Android 11?

  • You can now control media applications from a dedicated space within the notification area while enabling features such as playback resumption and seamless transfer.
  • New and updated 5g APIs help you unlock transformative new user experiences.
  • Adds new support for key game tools and technologies. On top of that foundation, we're building tools to both improve your game developer experience and help you better characterize the performance of your game, services to help you expand the reach of your game to more devices and new audiences, and new and improved features to support your games' go-to-market with Google Play.

Android 11 media

We covered how to take advantage of Android 11's new media controls by making sure your app is using MediaStyle with a valid MediaSession token. We showed how to support Media resumption by making your app discoverable with a MediaBrowserServiceCompat, using the EXTRA_RECENT hint to help with resuming content, and handling the onPlay and onGetRoot callbacks. Finally we showed you how to leverage the MediaRouter jetpack library to support seamless media transfer between devices. Check out the updated version of the UAMP sample which contains a reference implementation for media controls and playback resumption.

Android 11 and 5G

We covered some of the primary ways apps can benefit from 5g, including:

  • Turning indoor use cases into outdoor use cases
  • Turning photo-centric UX into video-centric or AR-centric UX
  • Prefetch helpfully to make your app even more responsive
  • Turn niche use cases into mainstream use cases, such as allowing streaming content everywhere

Android 11 adds new APIs and updates existing APIs to ensure you have all the tools you need to leverage the capabilities of 5G, such as an enhanced bandwidth estimation API, 5G detection capabilities, and a new meteredness flag from cellular carriers. The Android emulator now enables you to develop and test these APIs without needing a 5G device or network connection. All of this and more is available from our dedicated 5G page.

Catch up on what's happening with game development

We presented a special "11 Weeks" episode of The Android Game Developer Show providing an update on the tools, services, and technologies we're bringing to help you build, optimize, and distribute great games.

Check out d.android.com/games to learn about everything we've covered this week and more, and stay up to date by signing up for the games quarterly newsletter.

Android game development tooling

In Android Studio 4.1, we enhanced the System Trace view of the CPU Profiler and added the Native Memory Profiler, and both can now be launched standalone from Android Studio. The System Trace and Native Memory blog posts have more details on how to use them with your game or app.

You can sign up for developer previews of the Android Game Development Extension, and the Android GPU Inspector. The Android Game Development Extension helps with building multi-platform C/C++ games, while the GPU Inspector is used to profile and debug graphics. Stay tuned for the open beta of the Android GPU Inspector.

Reaching more devices and users with your game

We took a deep dive into the Android Performance Tuner, explaining annotations, quality levels, and fidelity parameters along with some best practices on how to use them. Once you've implemented that, we also covered how to use the new insights and analysis you'll get within Android Vitals.

We showed how Google Play Asset Delivery brings the benefits of app bundles to games with large asset sizes, flexible delivery modes, auto-updates, compression, and delta patching. Texture compression format targeting is coming very soon letting you tap into modern texture compression such as ASTC (now supported on over 50% of devices) allowing you to considerably cut your game size and in-memory footprint.

We published new codelabs to help you integrate Android Performance Tuner and Google Play Asset Delivery into your Unity or native C/C++ game.

We explained how we can help protect your game, players, and business by fighting monetization and distribution abuse.

Boost your games' go-to-market

We launched the open beta of Play Games Services - Friends to help you bootstrap and enhance your in-game friend networks while having your games surfaced in new clusters in the Play Games app.

We demonstrated the new release management experience in the Google Play Console beta and showed how it can help your testing and publishing workflow.

Day one auto-installs is a new Google Play feature that allows users to request the automatic installation of your game during pre-registration. Early experiments show a +20% increase in day 1 installs when using this feature. The new pre-registration menu in the beta Google Play Console makes it easier than ever to access this feature.

We showed how to optimize your store listing page to take advantage of the greatly improved games visual experience within Google Play, showcasing rich game graphics and engaging videos.

The new in-app review API lets you choose when to prompt users to write reviews from within your game, without heading back to the app details page. This API supports both public and private reviews for when your app is in beta.

Learning path

If you’re looking for an easy way to pick up the highlights of this week, check out the Games, media, and 5G pathway. A pathway is an ordered tutorial that allows users to complete a pre-defined module that culminates in a quiz. It includes videos and blog posts. A virtual badge is awarded to each user who passes the quiz. Test your knowledge of key takeaways about Android game development, media, and 5G to earn a limited edition badge.

Key takeaways

Thank you for tuning in and learning about the latest in Android game, media, and 5G development.

Seamless media transfer and media resumption

MediaRouter API (UAMP Sample)

5G

Bandwidth estimation API

5G Detection (Android Emulator)

Meteredness flag

Features found in Android Studio 4.1 (Beta Channel)

System Trace in Android Studio CPU Profiler

Android Studio Native Memory Profiler

Pre-release standalone tools

Android Game Development Extension

Android GPU Inspector.

Features in the Android Game SDK

Android Frame Pacing Library

Android Performance Tuner (C/C++ Codelab) (Unity Codelab)

Google Play features

Play Asset Delivery (C/C++ Codelab) (Unity Codelab)

In App Review API

App Licensing

SafetyNet Attestation

Pre-registration

Google Play Games Services

Play Games Services Friends Beta

You can find the entire playlist of #11WeeksOfAndroid video content here, and learn more about each week here. We’ll continue to spotlight new areas each week, so keep an eye out and follow us on Twitter and YouTube. Thanks so much for letting us be a part of this experience with you!

Introducing Google Play Asset Delivery

Posted by Dan Galpin, Developer Advocate

Two years ago, we introduced the Android App Bundle, a new publishing format that allows Google Play to help optimize your app delivery. The app bundle is now Play’s recommended publishing format; with almost 50% of all top apps & games already using it.

It replaces the traditional monolithic APK at publishing time, allowing you to package all of your languages, screen densities and device architectures into a single artifact. The bundle itself can't be installed; Play takes care of generating APKs optimized for each requesting device from the single bundle that you publish.

Dynamic Delivery with App Bundle Produces Optimized APKs

Dynamic Delivery with App Bundle Produces Optimized APKs

Apps have seen great success with app bundles, but games often have different delivery challenges.

Today, large Android games rely on APK Expansion Files and custom Content Delivery Networks (CDNs) to deliver content. APK Expansion Files, also known as OBBs, support large resources but require you to maintain an additional publishing artifact, which causes many developer issues. Using CDNs for resource delivery often results in a suboptimal user-experience; users install and open the game just to face a long progress bar as they wait for additional resources to be downloaded. Users may also have to wait for updated resources, rather than having them delivered as part of the game auto-update. Finally, CDNs usually aren’t free, so this way of delivering game assets also involves extra cost that needs to be accounted for.

To handle the unique needs of games, Play is introducing Play Asset Delivery, giving you dynamic delivery of the right game assets to the right devices at the right time at no additional cost. To achieve this, we extended the Android App Bundle publishing format by adding asset packs.

The contents of an Android App Bundle with one base module, two dynamic feature modules, and two asset packs.

The contents of an Android App Bundle with one base module, two dynamic feature modules, and two asset packs.

Asset packs contain non-code game content such as textures, materials, and sounds. They are served from Google Play with large size limits that are ideal for games, and you can customize how and when each asset pack is downloaded onto a device.

Keeping assets up-to-date

Play Asset Delivery (PAD) lets you rely on Google Play to take care of updating your assets, just like it does with your game binary. When your app auto updates, the entire game gets updated, including all assets. When your users open the game, they will already have the freshest binary and assets, and they won’t need to wait for resources to get updated. Play also takes care of delta patching for you, minimizing the download size and the update time.

To handle cases when the user opens the game before it has had a chance to update, you can trigger updates within the context of your game with our In-App Updates API.

Play Asset Delivery engine support

  • Version 4.25 of Unreal engine supports building App Bundles with asset packs instead of APK expansion files and includes a plugin that provides function calls for managing downloads and requesting information from Play Asset Delivery.
  • We have built a Unity plugin that takes care of packaging your Unity Asset Bundles into asset packs and lets you build an Android App Bundle that includes them. The plugin is now available in our Package Registry and is compatible with Unity 2017.4 and higher.
  • For other engines, that Android Gradle plugin 4.0 release lets you combine your asset packs and your binary into an App Bundle. Just update your gradle plugin version and configure the delivery mode in the build.gradle file for each individual asset pack.

Customizing when asset packs are installed

You can customize when asset packs are installed according to three delivery modes: install-time, fast-follow, and on-demand.

  • install-time asset packs allow you to deliver up to 1GB of game assets as part of the initial game installation. To your app, this works like a large APK, with no need for expansion files or special API calls. Just package your assets in asset packs and publish to Play.
  • fast-follow asset packs are automatically downloaded as soon as the app is installed, allowing the user to start playing while important assets are still downloading. The app doesn't have to be opened for the download to start.
  • on-demand asset packs are downloaded upon request by the app.

Both on-demand and fast-follow assets are delivered as raw files and placed in your game’s internal storage. You can track download progress with the PAD API and access the assets directly using file system calls.

Extending Android App Bundle for Games

When using Play Asset Delivery, you get to take advantage of the App Bundle format, which allows Play to optimize the binary for the device, making it easier to support both 64-bit and 32-bit devices and different CPU architectures such as ARM and X86. We also want to help you serve the optimal set of assets to each device, and the first step in this direction is texture compression format targeting.

In an upcoming release of Play Asset Delivery, you'll be able to package textures in multiple texture compression formats, relying on Play to serve optimal assets per device model. This means you won't need to compromise by using suboptimal texture compression formats, and your users will always get the best assets suitable for their device without wasting network bandwidth or having suboptimal loading performance.

Better retention with an improved install experience

image of car racing from Asphalt 8 game by Gameloft

Asphalt 8 by Gameloft

Gameloft integrated Play Asset delivery into Asphalt 8, Asphalt Xtreme, and Minion Rush. Asphalt Xtreme was easy to switch from using APK expansion files to using PAD with install-time delivery. Asphalt 8 and Minion Rush both originally used a custom CDN, which Gameloft replaced with PAD. They were able to leverage fast-follow and on-demand delivery by replacing their custom CDN calls with calls to the PAD API. They saw the expected reduction in CDN costs, but with fast-follow delivery, they have also seen a significant increase in the number of users who completed the secondary download to start playing the game. This resulted in better user retention, with 10% more new players compared to their previous CDN asset delivery system. With the promising early results and seamless implementation process, Gameloft plans to use PAD in more of their upcoming releases. Read more about their experience.

Improved user experience with cost savings

Puzzle Kids - Animals Shapes and Jigsaw Puzzles game

Puzzle Kids - Animals Shapes and Jigsaw Puzzles by RV AppStudios

US-based developer RV AppStudios has over 200 million downloads to date across their portfolio of casual games, educational kids apps, and utility apps. Their Puzzle Kids app delivers over 23 MB of assets as players progress through the levels. When they switched from a third-party CDN to using Play Asset Delivery’s on-demand mode, they saw a 4.7% increase in 15-day retention and 21% reduction in crashes & ANRs. Overall, these changes helped improve the user experience by offering more stable, transparent, and secure downloads, while also saving costs for RV AppStudios. Read more about their experience.

Play Asset Delivery is available now

We're committed to helping you serve your entire game through Play with customized dynamic delivery. Play Asset Delivery, with the new app bundle format for games, along with its three delivery modes and updates + patching are all generally available. You can find documentation at d.android.com that will walk you through the integration process depending on the game engine you use.