Author Archives: Android Developers

Faster Adoption with Project Treble

Posted by Iliyan Malchev, Project Treble Architect

Android P Beta available at android.com/beta

As Android continues to evolve, each new release of the OS brings new features, new user experiences, and better security. It is important that these new releases find their way to mobile devices as fast as possible.

Yesterday, we announced that the following devices, in addition to Pixel and Pixel 2, now support Android P Beta: Sony Xperia XZ2, Xiaomi Mi Mix 2S, Nokia 7 Plus, Oppo R15 Pro, Vivo X21, OnePlus 6 and Essential PH‑1. Android P Beta provides an opportunity for developers and early adopters around the world to try the latest Android release, test their apps, and provide feedback.

In this post, we provide an update to Project Treble and the technology that allowed us to bring Android Beta to more phones this year.

Building the Foundation

Bringing the new Android release quickly to the hands of users takes a combined effort between Google, silicon manufacturers (SM), device manufacturers (OEMs), and carriers. This process is technically challenging and requires aligning the schedules between our industry partners.

To reduce the technical difficulties, we launched Project Treble as part of Android Oreo.

The Silicon Manufacturers

Next, to capitalize on the foundation we built, we collaborated closely with the silicon manufacturers, where the journey of making an Android device always begins.

Any device with the latest version of Android must be based on an SoC with the proper software support for it. This software, commonly referred to as the Board Support Package (BSP), contains not only the chip-specific vendor implementation, but also all of the Android Open Source Project (AOSP) and pieces of the framework that are missing from AOSP itself (e.g., carrier-specific telephony functionality).

These BSPs are the starting point for all device launches. OEMs adapt the vendor implementation to their hardware and add their own custom framework components.

While silicon manufacturers always want the latest version of Android in their BSPs, the costs have been prohibitive. By making it possible for newer AOSP frameworks to run on older, already-released vendor implementations, Project Treble dramatically reduces the need for continuous investment in older silicon to support each Android release. Silicon manufacturers have to do all this work just once, rather than every time there is a new release of Android.

Solving the Timing Problem

However, that first time still has to happen. Below is a chart, which illustrates the effort the various actors expend over time as they go through each release. You can think of it as code churn or bug count over time.

The chart shows how there is very little time in the year for Google, silicon manufacturers, and the OEMs to all this work. Any overlap between phases causes code churn and introduces significant schedule risk. For OEMs who target the holiday season, it is often safer to launch on an older BSP with a year-old or even older Android version. This dynamic has been at the heart of the slow uptake of the latest Android release, even on flagship devices.

To solve this, we've worked closely with Qualcomm, MediaTek and Samsung SLSI to co-develop their BSPs, starting with Android P. Their BSPs are now ready for Android P on a much-accelerated schedule, reducing the overall effort significantly. These silicon manufacturers are now able to provide a stable and high-quality release much earlier than before, allowing OEMs to bring the latest innovations of Android to their customers across the globe.

This is an important step in accelerating the adoption of Android releases that bring numerous benefits to our partners, users, and Android developers. We look forward to seeing many more partners launch or upgrade devices to Android P.

Wear OS by Google: AoG support and new enhanced battery saver mode

Posted by Hoi Lam, Lead Developer Advocate, Wear OS by Google

At Google I/O, we launched the Wear OS by Google developer preview 2. This update added support for Actions on Google (AoG) and more power-related enhancements including a new battery saver mode.

This developer preview includes updated Android Emulator images and a downloadable system image for the Huawei Watch 2 Bluetooth or Huawei Watch 2 Classic Bluetooth. This preview release is intended for developers only and not for daily or consumer use. Therefore, the preview release is only available via manual download and flash. Please refer to the release notes for known issues before downloading and flashing your device.

Support for Actions on Google

We have revamped the Google Assistant on Wear OS to support features such as visual cards, follow-on suggestion chips, and text-to-speech. For developers, we added support for Actions on Google to Wear OS and existing Actions will work on Wear OS out of the box. Be sure to observe best practices for Actions on Google to get the best results such as short concise dialog and adopting to both visual and vocal feedback. This feature does not depend on Android P and is being rolled out to all Wear 2.0 users.

Enhanced battery saver mode

In this Android P developer preview, we are launching an enhanced battery saver mode. While the watch is in this mode, the watch shows a power-efficient watch face and turns off a set of services including radios, the touch screen, and tilt to wake. Users can get the time by pressing the side button. A long press allows the user to switch back to a fully-operational mode and perform tasks such as paying with NFC or replying to a message. Developers should assume that their apps, watch faces, and complication data providers are not available in enhanced battery saver mode.

Update on power saving features

We received much feedback on the power saving features in the last developer preview. As a result, we have updates on two features:

  • Roll back of Wi-Fi off when BT is disconnected: To improve power consumption, the last developer preview would not connect to Wi-Fi when disconnected from Bluetooth. After listening carefully to user and developer feedback, we decided to roll back this change.
  • Limited background activity and foreground service: A number of health and fitness developers have said their apps require background monitoring of the user's motion and other vitals throughout the day. The developers said their apps cannot perform background monitoring if background services are unable to set alarms and jobs. For these types of exceptional use cases, we recommend that the apps use foreground services to anchor alarms and jobs. For other use-cases, developer should look at both foreground service as well as limiting jobs and alarms to while the watch is on charger. We are still fine tuning this feature, your feedback and use-cases will be most helpful in helping us get this right.

Smart Reply for bridged notifications

Smart Reply has been enabled for bridged notifications from the user's smartphone for some time. With the latest developer preview, we are introducing simplified Chinese support for our users in China. This feature is powered by an on-device model using TensorFlow Lite and the model is optimized for low-memory, low-power devices.

To use this feature, developers should set setAllowGeneratedReplies of the reply action to true. Here's a sample code snippet with the important part highlighted in bold:

NotificationCompat.Action action =
    new NotificationCompat.Action.Builder(R.drawable.ic_reply_white_24dp,
        replyLabel, replyPendingIntent)
        .addRemoteInput(remoteInput)
        .setAllowGeneratedReplies(true) // <--- true to enable smart replies
        // Wear OS requires a hint to display the reply action inline.
        .extend(new NotificationCompat.Action.WearableExtender()
            .setHintDisplayActionInline(true))
        .build();

In addition, for messaging apps, we recommend that developers use MessagingStyle notifications. This can give the algorithm a more structured data set on which to base its recommendations.

Please give us your feedback

We expect to provide more updates to this preview before the final production release. Please submit any bugs you find via the Wear OS by Google issue tracker. The earlier you submit them, the higher the likelihood that we can include the fixes in the final release.

Google I/O 2018: What’s new in Android

Posted By Stephanie Cuthbertson, Product Management Director, Android

As Android has grown exponentially over the past ten years, we've also seen our developer community grow dramatically. In countries like China, India, and Brazil, the number of developers using our IDE almost tripled - in just two years. With such growth, we feel an even greater responsibility to invest in our developer experience. Guided by your feedback, we've focused our efforts on making mobile development fast and easy, helping you get more users by making apps radically smaller, and increasing engagement to keep users coming back. We're also pretty excited to see Android Things go to 1.0, creating new opportunities for you to develop - everything from major consumer devices, to cool remote control vehicles! As Day 1 of Google I/O kicks off, let's take a closer look at these major themes from the Developer Keynote:

Development: making mobile development fast and easy

  • Android Jetpack — Today, we announced Android Jetpack, designed to accelerate your app development. Android Jetpack is the next generation of Android components, bringing together the benefits of the Support Library -- backwards compatibility and immediate updates -- to a larger set of components, making it quick and easy to build robust, high quality apps. Android Jetpack manages activities like background tasks, navigation, and lifecycle management, so you can eliminate boilerplate code and focus on what makes your app great. Android Jetpack is designed to work well with Kotlin, saving you even more code with Android KTX. The new Android Jetpack components released today include WorkManager, Paging, Navigation, and Slices.
  • Kotlin — Since announcing support for Kotlin last year, the developer community has embraced the language. Most importantly, 95% of developers tell us they are very happy with using Kotlin for their Android development. And, the more developers use it, the more that number rises. The number of Play Store apps using Kotlin grew 6x in the last year. 35% of pro developers use it, and that number is growing each month. We are continuing to improve the Kotlin developer experience across our libraries, tooling, runtime, documentation and training. Android KTX is launching today as part of Android Jetpack to optimize the Kotlin developer experience. Tooling continues to improve with Android Studio, Lint support, and R8 optimizations. We have even tuned the Android Runtime (ART) in Android P, so that apps built with Kotlin can run faster. We have rolled out Kotlin code snippets in our official documentation, and are publishing a Kotlin version of the API reference documentation today. Earlier this week, we launched a new Kotlin Bootcamp on Udacity, which is a great resource for developers who are new to Kotlin. Lastly, we now have a Kotlin specialization in the Google Developers Experts Program. If you still haven't used Kotlin, I hope you you give it a try.
  • Android Studio 3.2 CanaryAndroid Studio 3.2 features tools for Android Jetpack including a visual Navigation Editor and new code refactoring tools. The canary release also includes build tools to create the new Android App Bundle format, Snapshots in the Android Emulator for fast start time, new R8 optimizer for smaller download and install app code size, a new Energy Profiler to measure app impact on battery life, and more. You can download the latest version of Android Studio 3.2 from the canary channel download page.

Distribution: making apps radically smaller

  • Android App Bundle & Google Play Dynamic Delivery — Introducing the new app model for Android. Dramatically reduce app size with a new publishing format—the Android App Bundle. In Android Studio, you'll now build an app bundle that contains everything your app needs for any device—all the languages, every device screen size, every hardware architecture. Then, when a user downloads your app, Google Play's new Dynamic Delivery will only deliver the code and resources matching the user's device. People see a smaller install size on the Play Store, can download your app more quickly, and save space on their devices.

    (Left) An example of all resources being delivered to a device via a legacy APK.
    (Right) An example of Dynamic Delivery serving just what’s needed to a device.

  • Dynamic features via the Android App Bundle — The Android App Bundle also enables modularization so that you can deliver features on-demand, instead of during install. You can build dynamic feature modules in the latest Android Studio canary release. Join our beta program to publish them on Google Play.
  • Google Play Console — New features and reports in the Play Console will help you improve your app's performance and grow your business. Read about the improvements to the dashboard, statistics, Android vitals, pre-launch report, acquisition report, and subscriptions dashboard. You can also upload, test, and publish apps using our new publishing format, the Android App Bundle.
  • Google Play Instant — After launching in beta at GDC, today we announced that all game developers can build instant apps and we're thrilled to welcome Candy Crush Saga. Google Play Instant is now available on over 1 billion devices worldwide from the Play Store, search, social and most places you can tap a link. To make instant apps easier to build, we are launching a Unity plugin and beta integration with Cocos creator this week. Recently, we've started testing Google Play Instant compatibility with AdWords, allowing people to try out games directly from ads, across all the channels reached by Universal App campaigns.

Engagement: bringing users back more and more.

  • Slices Slices are UI templates that display a rich array of dynamic, and interactive content from your app, across Android and within Google surfaces. Slices can include live-data, scrolling content, inline actions, and deep-linking into your app so users can do everything from playing music to checking reservation updates. Slices can also contain interactive controls like toggles and sliders. You can get started building Slices today, and they will begin appearing for users soon.

  • Actions — Actions are a new way to make your app's capabilities and content more accessible, so that people can easily get to it at the right moment. App Actions will appear to users based on usage and relevance, across multiple Google and Android surfaces, such as the Google Search App, the Play Store, the Google Assistant, and the Launcher. App Actions will be available for all developers to try soon, please sign up here if you'd like to be notified. You can also choose to build a Conversational Action as a companion experience to your app. This works on a variety of Assistant-enabled devices, such as speakers and smart displays. Both types of Actions use a new common catalog of intents.

Smarter devices: a powerful platform for IoT devices

  • Android Things 1.0 Android Things is Google's managed OS that enables developers to build and maintain Internet of Things devices at scale. Earlier this year at CES, we announced Lenovo, Harman, LG, and iHome are all building Assistant-enabled products powered by Android Things. After a developer preview with over 100,000 SDK downloads and feedback from more than 10,000 developers, we announced Android Things 1.0 this week. Four new System-on-Modules (SoMs) are now supported on the platform with guaranteed long-term support for three years and additional options for extended support, making it easier to go from prototypes to production. To make product development more seamless than ever, the accompanying Android Things Console is also ready for production. It helps developers easily manage and update their devices with the latest stability fixes and security updates provided by Google.

    To get started with Android Things, visit our developer site and the new Community Hub to explore kits, sample code, community projects, and join Google's IoT Developers Community to stay updated. We introduced a limited program to partner with the Android Things team for technical guidance and support building your product. If your company is interested, sign up for our OEM Partner Program.

In addition to all these new developments, we're on the ground in over 140 countries, growing and expanding the developer community through programs such as Women Techmakers and Google Developer Groups (GDGs). We're investing in training programs like Google Developers Certification, building more courses through Udacity and other partners, to help developers deepen their technical capability. Today, 225 Google Developers Agency Program members from 50 agencies in 15 countries, are Android Certified. As part of our Google Developers Experts Program, we also now have more than 90 Android Developer Experts around the world actively supporting developers, start-ups and companies to build and launch innovative apps.

We also continue to recognize the great work from top app and game developers. This year, we held our third annual Google Play Awards. The nominees represent some of the best experiences available on Android, with an emphasis on overall quality, strong design, technical performance, and innovation. Check out the winners and nominees.

During Google I/O, attendees and viewers have an opportunity to dive deep with 48 Android & Play breakout sessions. Thank you for all your wonderful feedback, and please keep giving us your advice on where we should go next.

I/O 2018: Everything new in the Google Play Console

Posted by Tian Lim, VP of UX and Product, Google Play

Google Play connects a thriving ecosystem of developers to people using more than 2 billion active Android devices around the world. In fact, more than 94 billion apps were installed from Google Play in the last year alone. We’re continuing to empower Android developers with new features in the Play Console to help you improve your app’s performance and grow your business. And, at Google I/O 2018, we’re introducing our vision for a new Android app model that is modular and dynamic.

Benefit from size savings with the Android App Bundle

The Android App Bundle is Android's new publishing format, with which you can more easily deliver a great experience in a smaller app size, and optimize for the wide variety of Android devices and form factors available. The app bundle includes all your app's compiled code and resources, but defers APK generation and signing to Google Play. You no longer have to build, sign, and manage multiple APKs.

Google Play's new app serving model, called Dynamic Delivery, uses your app bundle to generate and serve optimized APKs for each user's device configuration. This means people download only the code and resources they need to run your app. People see a smaller install size on the Play Store, can install your app more quickly, and save space on their devices.

(Left) An example of all resources being delivered to a device via a legacy APK.
(Right) An example of Dynamic Delivery serving just what’s needed to a device.

With the Android App Bundle, you're also able to add dynamic feature modules to your app. Through Dynamic Delivery, your users can download your app's dynamic features on-demand, instead of during the initial install, further reducing your app's download size. To publish apps with dynamic feature modules, apply to join the beta.

Start using the Android App Bundle in the latest Android Studio canary release. Test your release using the testing tracks in the Play Console before pushing to production. Watch these I/O sessions to hear from the team as they introduce the new app model:

Fix quality and performance issues in your app or game

An internal study Google ran last year found that over 40% of one-star reviews on the Play Store mentioned app stability as an issue. Conversely, people consistently reward the best performing apps with better ratings and reviews, leading to better rankings on Google Play and more installs. Not only that, but people tend to be more engaged and willing to spend more time and money in those apps. To help you understand and fix quality issues we're improving a number of features in the Google Play Console.

  • Use the new internal test track to push your app to up to 100 internal testers in seconds before you release them to alpha, beta, or production. You can also have multiple closed test tracks for different versions of your app, before pushing them to open betas or production.
  • The pre-launch report summarizes issues found in alpha or beta versions of your app, based on automated testing on popular devices in Firebase Test Lab. There are several new features to help you test the parts of your app or game that crawlers find harder to reach: create demo loops for games written with OpenGL, record scripts in Android Studio for the test crawler to follow, identify deep links, and provide credentials to go behind logins. In addition to reporting crashes, performance and security issues, and taking screenshots of the crawled screens, the report will soon identify accessibility issues you should fix to ensure a positive user experience for the widest audience.
  • Android vitals now analyzes data about startup time and permission denials in addition to battery, rendering, and stability. The revamped dashboard highlights crash rate, ANR rate, excessive wakeups, and stuck wake locks: the core vitals developers should give attention to. All other vitals, when applicable to your type of app or game, should be monitored to ensure they aren't having a negative effect. You'll also see anomalies in any vitals, when there's a sudden change you should be aware of, and benchmarks so that you can compare your app's performance to that of similar apps. Exhibiting bad behavior in vitals will negatively affect the user experience in your app and is likely to result in bad ratings and poor discoverability on the Play Store.


Watch these I/O sessions where we introduce the new features and share examples of how developers are using them successfully:

Improve your store performance and user acquisition

The Play Console has tools and reports to help your whole team understand and improve your app's store performance and business metrics. The Play Console's access management controls were recently improved so you can more easily grant access to your whole team while having granular control over which data and tools they can see and use.

  • The app dashboard has been improved so you can quickly digest need-to-know information and take action. The dashboard now shows more data, is easier to read, and is customizable. This should be your first stop to understand the latest activity around your app or game.
  • You can now configure the statistics report to show you how your instant apps are performing. See how many people are launching your instant app by different dimensions and how many go on to install the full app on their device. All app and game developers can build instant experiences today. Learn more in the instant apps documentation.
  • The acquisition report will start showing you more data about how people find your app and whether they go on to install it and make purchases. You can now see average revenue per user and retention benchmarks, to compare your app's performance to similar apps, at every state of the acquisition funnel. Organic breakdown, rolling out soon, will separate the number of people who find your store listing by searching the Play Store from those who get there via browsing. You will also be able to see what search terms are driving the most traffic, conversions, and purchases. With these improvements, you can further optimize your efforts to grow and retain a valuable audience.
  • Order management has also been updated to enable you to offer partial refunds for in-app products and subscriptions.


Watch these I/O sessions where we introduce the new features and share examples of how developers are using them successfully:

Grow and optimize your subscriptions business

Subscriptions continue to see huge growth, with subscribers on Google Play growing over 80% year over year. Google Play Billing offers developers useful features to acquire, engage, and retain subscribers, and gives users a consistent and familiar purchase flow. We're making improvements to help you prepare your subscriptions business for the future and to give users more information on their subscriptions.

  • With the Google Play Billing Library, you can easily integrate new features with minimal coding. Now with newly-released version 1.1, you can upgrade subscriptions without changing the renewal date. Also, you will soon be able to make price changes to existing SKUs.
  • The new subscriptions center on Google Play lets people manage their active subscriptions, including fixing payment issues or restoring canceled subscriptions. You can create deep links so your users can directly access subscription management options on the Play Store. Soon, people who cancel subscriptions will have the option to leave feedback stating why, which you will have access to in the Play Console.
  • Subscription reports in the Play Console have been updated to help you better understand your retention and churn across multiple subscriptions, times, and territories. You can now measure whether features such as free trials, account holds, and grace periods are successful in acquiring and retaining users.


Watch our I/O session where we explain the new features:

Prepare for the upcoming Play requirement for target API level

As we have announced, Google Play will require new apps (from August 2018) and app updates (from November 2018) to target API level 26 or higher. For more information and practical guidance on preparing for the new requirement, watch the I/O session, Migrating your existing app to target Android Oreo and above, and review our migration guide. If you develop an SDK or library that's used by developers, make sure it's ready to target Oreo too and sign up to receive news and updates for SDK providers.

Get more resources to help you succeed on Google Play

To find out more about all these new features, learn best practices, understand how other developers are finding success, and hear from the teams building these features, watch the Android & Play sessions at I/O 2018. For more developer resources about how to improve your app's performance on Google Play, read this guide to the Google Play Console and visit the Android developers website. Finally, to stay up to date, sign up to our newsletter and follow us on Twitter, LinkedIn, and Medium where we post regularly.

How useful do you find this blogpost?

Android Studio 3.2 Canary

Today at Google I/O 2018 we announced the latest preview of Android Studio 3.2 which includes an exciting set of features that support the Android P Developer Preview, the new Android App Bundle, and Android Jetpack. Download Android Studio 3.2 from our canary release channel today to explore one of the most feature rich releases of the year.

Android Jetpack is a set of libraries, developer tools and architectural guidance to help make it quick and easy to build great Android apps. It provides common infrastructure code so you can focus on what makes your app unique. Android Studio 3.2 includes a wide set of tools that support Jetpack from a visual Navigation Editor that uses the Navigation API, templates for Android Slices APIs, to refactoring tools to migrate to the new Android support libraries in Jetpack — AndroidX.

The canary 14 release of Android Studio 3.2 also supports the new Android app model that is the evolution of the APK format, the Android App Bundle. With no code changes, Android Studio 3.2 will help you create a new Android App Bundle and have it ready for publishing on Google Play.

There are 20 major features in this release of Android Studio spanning from ultra fast Android Emulator Snapshots, Sample Data in the Layout Editor, to a brand new Energy Profiler to measure battery impact of your app. If any of these features sound interesting, download the preview of Android Studio 3.2 today.

To see these features demoed in action and to get a sneak peak at other features we are working on, check out the Google I/O 2018 session - What's new in Android Development Tools.

Below is a full list of new features in Android Studio 3.2, organized by key developer flows.

Develop

  • Navigation Editor - As a part of Jetpack, Android Studio 3.2 features a new way to design the navigational structure between the screens of your app. The navigation editor is a visual editor which allows you to construct XML resources that support using the new Navigation Component in Jetpack.

Navigation Editor



  • AndroidX Refactoring Support - One of the components of Jetpack is rethinking and refactoring the Android Support Libraries to a new Android extension library (AndroidX) namespace. As a part of the early preview of the AndroidX, Android Studio 3.2 helps you through this migration with a new refactoring action. To use the feature, navigate to: RefactorRefactor to AndroidX. As an additional enhancement to the refactoring process, if you have any maven dependencies that have not migrated to the AndroidX namespace, the Android Studio build system will automatically convert those project dependencies as well. You can manually control the conversion process by toggling the android.enableJetifier = true flag in your gradle.properties file. While the refactoring action supports common project configurations, we recommend that you save a backup of your project before you refactor. Learn more.

AndroidX Refactoring Support



  • Sample Data - Many Android layouts have runtime data that can make it difficult to visualize the look and feel of a layout during the design stage of app development. Sample Data in the Layout Editor allows you to use placeholder data to aid in the design of your app. From RecyclerView, ImageView to TextView, you can add built-in sample data to populate these views via a popup-window in the Layout Editor. To try out the feature, add a RecyclerView to a new layout, and then click on the new tools design-time attributes icon and choose a selection out of the carousel of sample data templates.

Design Time Sample Data



  • Material Design Update - Material Design continues to evolve not only as a design system but also in implementation on Android. When you start migrating from the Android Design support library to the new MaterialComponents app theme and library, Android Studio 3.2 will offer you access to new and updated widgets such as BottomAppBar, buttons, cards, text fields, new font styles and more. Learn more.

New Material Design Components



  • Slices support - Slices is a new way to embed portions of your app content in other user interface surfaces in the Android operating system. Slices is backwards compatible to Android 4.4 KitKat (API 19) and will enable you to surface app content in Google Search suggestions. Android Studio 3.2 has a built in template to help you extend your app with the new Slice Provider APIs as well as new lint checks to ensure that you're following best practices when constructing the slices. To get started right-click on a project folder, and navigate to NewOtherSlice Provider. Learn how to test your slice interactions by checking out the getting started guide.

Slices Provider Template



  • CMakeList Editing Support - Android Studio supports CMake build scripts for your app's C/C++ code. With this release of Android Studio 3.2, code completion and syntax highlighting now works on common CMakeList commands.

CMakeList Code Completion



  • What's New Assistant - Android Studio 3.2 has a new assistant panel that opens automatically after an update to inform you about the latest changes to the IDE. You can also open the panel by navigating to Help → What's New in Android Studio.

What's New Assistant



  • IntelliJ Platform Update - Android Studio 3.2 includes the IntelliJ 2018.1 platform release, which has many new features such as data flow analysis, partial Git commits support, and a ton of new code analysis enhancements. Learn more.

Build

  • Android App Bundle- The Android App Bundle is the new app publishing format designed to help you deliver smaller APKs to your users. Google Play has a new Dynamic Delivery platform that accepts your Android App Bundle, and delivers only the APKs that you need on a specific device. Android Studio 3.2 enables you to create and test an Android App Bundle. As long as you are running the latest Android Gradle plugin (com.android.tools.build:gradle:3.2.0-alpha14), you can rebuild your code as an app bundle and get the benefit of smaller APKs based on language, screen density, and ABIs with no changes to your app code. To get started, navigate to Build Build Bundle / APK or BuildGenerate Signed Bundle / APK Learn more.

Build Android App Bundle



  • D8 Desugaring - In some cases, new Java Language features require new bytecodes and language APIs, however older Android devices may not support these features. Desugaring allows you to use these features on older devices by replacing new bytecodes and language APIs with older ones during the build process. Desugaring was initially introduced with Android Studio 3.0 as a separate tool, and in Android Studio 3.1, we integrated the desugaring step into the D8 tool as an experimental feature, reducing overall build time. Now D8 desugaring is turned on by default for Android Studio 3.2. You can you can now use most of the latest language changes while targeting older devices.

  • R8 Optimizer - During the app build process, Android Studio historically used ProGuard to optimize and shrink Java language bytecode. Starting with Android Studio 3.2, we are starting the transition to use R8 as a replacement to ProGuard. To experiment with R8, add android.enableR8=true to your gradle.properties file. R8 is still experimental, so we do not recommend publishing your app using R8 yet. Learn more.

Enable R8 in Android Studio


Test

  • Emulator Snapshots - With Quickboot in the Android Emulator we enabled you to launch the emulator in under 6 seconds. With Android Studio 3.2 we have extended this feature to enable you to create snapshots at any emulator state and start them iun under 2 seconds. When testing and developing your app, you can pre-configure an Android Virtual Device (AVD) snapshot with the presets, apps, data and settings that you want in-place, and repeatedly go back to the same snapshot. Snapshots load in under 2 seconds and you can launch to specific snapshots from the Android Emulator Extended Controls panel, the command-line ( ./adb emu avd snapshot load snap_2018-04-29_00-01-12 ) or from within Android Studio.

Android Emulator Snapshots



  • Screen Record in Android Emulator - Normally creating a screen recording of your app screen would only work for Android 4.4 KitKat (API 19) and above with no audio, with limited Android Emulator support. With the latest Android Emulator (v27.3+), you can take screen recordings on any API level with audio. Plus, there is a built-in conversion to output to GIF and WebM. You can trigger the new screen record feature via the Android Emulator Extended Controls panel, command line ( ./adb emu screenrecord start --time-limit 10 /sample_video.webm ), and from Android Studio.

Screen record in Android Emulator



  • Virtual Scene Camera for Android Emulator - Developing and testing apps with ARCore is now even easier with the new Virtual Scene camera, which allows you to iterate on your augmented reality (AR) experience within a virtual environment. The emulator is calibrated to work with ARCore APIs for AR apps and allows you to inject virtual scene bitmap images. The virtual scene camera can also be used as a regular HAL3 compatible camera. Open the built-in Android camera app inside the Android Emulator to get started. By default, the new virtual scene camera is the rear camera for new Android Virtual Devices created with Android Studio 3.2. Learn more.

Virtual Scene Camera in Android Emulator



  • ADB Connection Assistant - To help troubleshoot your Android device connections via ADB, Android Studio 3.2 has a new assistant. The ADB Connection Assistant walks you through common troubleshooting steps to connect your Android device to your development machine. You can trigger the assistant from the Run Dialogue box or by navigating to ToolsConnection Assistant .

ADB Connection Assistant



Optimize

  • Energy Profiler - Battery life is a key concern for many phone users, and your app may impact battery life more than you realize. The new Energy Profiler in the performance profiler suite can help you understand the energy impact of your app on an Android device. You can now visualize the estimated energy usage of system components, plus inspect background events that may contribute to battery drain. To use the energy profiler, ensure you are connected to an Android device or emulator running Android 8.0 Oreo (API 26) or higher. Learn more.

Energy Profiler

  • System Trace - The new System Trace feature in the CPU Profiler allows you to inspect how your app interacts with system resources in fine-grained detail. Inspect exact timings and durations of your thread states, visualize where your CPU bottlenecks are across all cores, and add custom trace events to analyze. To use system trace, start profiling your app, click into the CPU Profiler, and then choose the System Trace recording configuration. Learn more.

System Trace

  • Profiler Sessions - We now automatically save Profiler data as "sessions" to revisit and inspect later while you have Android Studio open. We've also added the ability to import and export your CPU recordings and heap dumps for later analysis or inspection with other tools.

Profiler Sessions



  • Automatic CPU Recording - You can now automatically record CPU activity using the Debug API. After you deploy your app to a device, the profiler automatically starts recording CPU activity when your app calls startMethodTracing(String tracePath), and stops recording when your app calls stopMethodTracing(). Similarly, you can also now automatically start recording CPU activity on app start-up by enabling this option in your run configuration.
  • JNI Reference Tracking - For those of you who have C/C++ code in your Android app, Android Studio 3.2 now allows you to inspect the memory allocations of your JNI code in the Memory Profiler. As long as you deploy your app to a device running Android 8.0 Oreo (API 26) and higher, you can drill down into the allocation call stack from your JNI reference. To use the feature, start a memory profiler session, and select the JNI Heap from the Live Allocation drop-down menu.

JNI Reference Tracking

To recap, the latest canary of Android Studio 3.2 includes these new major features:

Develop
  • Navigation Editor
  • AndroidX Refactoring
  • Sample Data
  • Material Design Update
  • Android Slices
  • CMakeList editing
  • What's New Assistant
  • New Lint Checks
  • Intellij Platform Update

Build

  • Android App Bundle
  • D8 Desugaring
  • R8 Optimizer
Test
  • Android Emulator Snapshots
  • Screen Record in Android Emulator
  • Virtual Scene Android Emulator Camera
  • ADB Connection Assistant

Optimize

  • Energy Profiler
  • System Trace
  • Profiler Sessions
  • Automatic CPU Recording
  • JNI Reference Tracking

Check out the preview release notes for more details.

Getting Started

Download

Download the latest version of Android Studio 3.2 from the canary channel download page. If you are using a previous canary release of Android Studio, make sure you update to Android Studio Canary 14 or higher. If you want to maintain a stable version of Android Studio, you can run the stable release version and canary release versions of Android Studio at the same time. Learn more.

To use the mentioned Android Emulator features make sure you are running at least Android Emulator v27.3+ downloaded via the Android Studio SDK Manager.

We appreciate any early feedback on things you like, and issues or features you would like to see. Please note, to ensure we maintain product quality, the features you see in the canary channel may not be available in the next stable release channel until they are ready for stable usage. If you find a bug or issue, feel free to file an issue. Connect with us -- the Android Studio development team ‐ on our Google+ page or on Twitter.

Use Android Jetpack to Accelerate Your App Development

Posted by Chris Sells, Benjamin Poiesz, Karen Ng, Product Management, Android Developer Tools

Today we're excited to introduce Android Jetpack, the next generation of components, tools and architectural guidance to accelerate your Android app development.

Android Jetpack was inspired by the Support Library, a set of components to make it easy to take advantage of new Android features while maintaining backwards compatibility; it's currently used by 99% of every app in the Play Store. Following on that success, we introduced the Architecture Components, designed to make it easier to deal with data in the face of changes and the complications of the app lifecycle. Since we introduced those components at I/O just one year ago, an overwhelming number of you have adopted them. Companies such as LinkedIn, Zillow and iHeartRadio are seeing fewer bugs, higher testability and more time to focus on what makes their app unique.

The Android developer community has been clear -- not only do you like what we've done with these existing components, but we know that you want more! And so more is what you get.

What is Android Jetpack?

Android Jetpack is a set of components, tools and guidance to make great Android apps. The Android Jetpack components bring together the existing Support Library and Architecture Components and arranges them into four categories:

Android Jetpack components are provided as "unbundled" libraries that are not part of the underlying Android platform. This means that you can adopt each component at your own speed, at your own time. When new Android Jetpack functionality is available, you can add it to your app, deploy your app to the Play Store and give users the new features all in a single day (if you're quick)! The unbundled Android Jetpack libraries have all been moved into the new androidx.* namespace (as described in detail in this post).

In addition, your app can run on various versions of the platform because Android Jetpack components are built to provide their functionality independent of any specific version, providing backwards compatibility.

Further, Android Jetpack is built around modern design practices like separation of concerns and testability as well as productivity features like Kotlin integration. This makes it far easier for you to build robust, high quality apps with less code. While the components of Android Jetpack are built to work together, e.g. lifecycle awareness and live data, you don't have to use all of them -- you can integrate the parts of Android Jetpack that solve your problems while keeping the parts of your app that are already working great.

We know that these benefits are important to you because of feedback like this:

"We had been thinking of trying out MVVM in our code base. Android Architecture Components gave us an easy template to implement it. And it's helped make our code more testable as well; the ability to unit test ViewModels has definitely increased code robustness."

-- Sumiran Pradhan, Sr. Engineer, Zillow

If you want to learn more about how companies are using Android Jetpack components, you can read the developer stories on the Android Developer site.

And finally, as you can see from the Android Jetpack diagram above, today we're announcing new components as well.

What's New

Android Jetpack comes with five new components:

  • WorkManager alpha release
  • Navigation alpha release
  • Paging stable release
  • Slices alpha release
  • Android KTX (Kotlin Extensions) alpha release

WorkManager

The WorkMananager component is a powerful new library that provides a one-stop solution for constraint-based background jobs that need guaranteed execution, replacing the need to use things like jobs or SyncAdapters. WorkManager provides a simplified, modern API, the ability to work on devices with or without Google Play Services, the ability to create graphs of work, and the ability to query the state of your work. Early feedback is very encouraging but we love to make sure that your use cases are covered, too. You can see what we have so far and provide feedback on our alpha on the WorkManager component.

Navigation

While activities are the system provided entry points into your app's UI, their inflexibility when it comes to sharing data between each other and transitions has made them a less than ideal architecture for constructing your in-app navigation. Today we are introducing the Navigation component as a framework for structuring your in-app UI, with a focus on making a single-Activity app the preferred architecture. With out of the box support for Fragments, you get all of the Architecture Components benefits such as Lifecycle and ViewModel while allowing Navigation to handle the complexity of FragmentTransactions for you. Further, the Navigation component allows you to declare transitions that we handle for you, automatically builds the correct Up and Back behavior, includes full support for deep links, and provides helpers for connecting Navigation into the appropriate UI widgets, like the navigation drawer and bottom navigation. But that's not all! The Navigation Editor in Android Studio 3.2 allows you to see and manage your navigation properties visually:

The Navigation component is also in alpha and we'd love your feedback.

Paging

Data presented in an app can be large and costly to load, so it's important to avoid downloading, creating, or presenting too much at once. The Paging component version 1.0.0 makes it easy to load and present large data sets with fast, infinite scrolling in your RecyclerView. It can load paged data from local storage, the network, or both, and lets you define how your content gets loaded. It works out of the box with Room, LiveData, and RxJava.

Slices

And finally, to round out the set of new features making their debut in Android Jetpack is the Slices component. A "slice" is a way to surface your app's UI inside of the Google Assistant as a result of a search:

You can learn all about the Slices component and how to integrate it into your app on the Android Developer website.

Android KTX

And last but not least, one goal of Android Jetpack takes advantage of Kotlin language features that make you more productive. Android KTX lets you transform Kotlin code like this:

view.viewTreeObserver.addOnPreDrawListener(
  object : ViewTreeObserver.OnPreDrawListener {
    override fun onPreDraw(): Boolean {
      viewTreeObserver.removeOnPreDrawListener(this)
      actionToBeTriggered()
      return true
    }
});

into more concise Kotlin code like the following:

view.doOnPreDraw { actionToBeTriggered() }

This is just the first step in bringing Kotlin support to Android Jetpack components; our goal is to make Android Jetpack great for Kotlin developers (and of course Java developers!).You can read more about Android KTX on the Android Developer web site.

Getting Started

You can get started with Android Jetpack at developer.android.com/jetpack. You'll find docs and videos for Android Jetpack, see what's new in Android Jetpack components, participate in the community and give us feedback. We've also created a YouTube playlist devoted to Android Jetpack, so you can tune in for information about Android Jetpack, components, tools and best practices.

Getting Started with Android Jetpack will tell you how to bring the Android Jetpack components into your existing apps and help you get started with new Android Jetpack apps. Android Studio 3.2 has great tooling support for Android Jetpack. For building new apps, use the Activity & Fragment+ViewData activity, which you can get to from File | New | New Project in Android Studio:

What's Next

With Android Jetpack, we're taking the benefits of the Support Library and the Architecture Components and turning it up a notch with new components, Android Studio integration and Kotlin support. And while Android Jetpack provides the next generation components, tools and guidance to accelerate your Android development, we've got a lot more that we want to do and we want your help. Please go to developer.android.com/jetpack and let us know what we can do to make your experience building Android apps even better.

What’s new in Android P Beta

Posted By Dave Burke, VP of Engineering

Earlier today we unveiled a beta version of Android P, the next release of Android. Android P puts AI at the core of the operating system and focuses on intelligent and simple experiences. You can read more about the new user features here.

For developers, Android P beta offers a range of ways to take advantage of these new smarts, especially when it comes to increasing engagement with your apps.

You can get Android P beta on Pixel devices by enrolling here. And thanks to Project Treble, you can now get the beta on top devices from our partners as well -- Essential, Nokia, Oppo, Sony, Vivo, and Xiaomi, with others on the way.

Visit android.com/beta for the full list of devices, and details on how to get Android P beta on your device. To get started developing with Android P beta, visit developer.android.com/preview.

A smarter smartphone, with machine learning at the core

Android P makes a smartphone smarter, helping it learn from and adapt to the user. Your apps can take advantage of the latest in machine intelligence to help you reach more users and offer new kinds of experiences.

Adaptive Battery

Battery is the number one priority we hear from mobile phone users, regardless of the device they are using. In Android P we've partnered with DeepMind on a new feature we call Adaptive Battery that optimizes how apps use battery.

Adaptive Battery uses machine learning to prioritize access to system resources for the apps the user cares about most. It puts running apps into groups with different restrictions using four new "App Standby buckets" ranging from "active" to "rare". Apps will change buckets over time, and apps not in the "active" bucket will have restrictions in: jobs, alarms, network and high-priority Firebase Cloud Messages.

If your app is optimized for Doze, App Standby, and Background Limits, Adaptive Battery should work well for you right out of the box. We recommend testing your app in each of the four buckets. Check out the documentation for the details.

App Actions

App Actions are a new way to raise the visibility of your app to users as they start their tasks. They put your app's core capabilities in front of users as suggestions to handle their tasks, from key touch-points across the system like the Launcher and Smart Text Selection, Google Play, Google Search app, and the Assistant.

Actions use machine learning to surface just the right apps to users based on their context or recent interactions. Because Actions highlight your app where and when it's most relevant, they're a great way to reach new users and re-engage with existing users.

To support App Actions, just define your app's capabilities as semantic intents. App Actions use the same catalog of common intents as conversational Actions for the Google Assistant, which surface on voice-activated speakers, Smart displays, cars, TVs, headphones, and more. There's no API surface needed for App Actions, so they will work on any supported Android platform version.

Actions will be available soon for developers to try, sign up here if you'd like to be notified.

Slices

Along with App Actions we're introducing Slices, a new way for your apps to provide remote content to users. With Slices you can surface rich, templated UI in places like Google Search and Assistant. Slices are interactive with support for actions, toggles, sliders, scrolling content, and more.

Slices are a great new way to engage users and we wanted them to be available as broadly as possible. We added platform support in Android P, and we built the developer APIs and templates into Android Jetpack, our new set of libraries and tools for building great apps. Through Jetpack, your Slices implementation can target users all the way back to Kitkat -- across 95% of active Android devices. We'll also be able to update the templates regularly to support new use cases and interactions (such as text input).

Check out the Getting Started guide to learn how to build with Slices -- you can use the SliceViewer tool to see how your Slices look. Over time we plan to expand the number of places that your Slices can appear, including remote display in other apps.

Smart reply in notifications

The Smart Reply feature in Gmail and Inbox are excellent examples of how machine intelligence can positively transform an app experience. In Android P we've brought Smart Replies to Notifications with an API to let you provide this optimization to your users. To make it easier to populate replies in your notifications, you'll soon be able to use ML Kit -- see developers.google.com/mlkit for details.

Text Classifier

In Android P we've extended the ML models that identify entities in content or text input to support more types like Dates and Flight Numbers and we're making those improvements available to developers through the TextClassifier API. We're also updating the Linkify API that automatically creates links to take advantage of these TextClassification models and have enriched the options the user has for quick follow on actions. Developers will have additional options of linkifying any of the entities recognized by the TextClassifier service. Smart Linkify has significant improvements in accuracy and precision of detection and performance.

Even better, the models are now updated directly from Google Play, so your apps can take advantage of model improvements using the same APIs. Once the updated models are installed, all of the entity recognition happens on-device and data is not sent over the network.

Simplicity

We put a special emphasis on simplicity in Android P, evolving Android's UI to streamline and enhance user tasks. For developers, the changes help improve the way users find, use, and manage your apps.

New system navigation

We're introducing a new system navigation in Android P that gives users easier access to Home, Overview, and the Assistant from a single button on every screen. The new navigation simplifies multitasking and makes discovering related apps much easier. In the Overview, users have a much larger view of what they were doing when they left each app, making it much easier to see and resume the activity. The Overview also provides access to search, predicted apps, and App Actions, and takes users to All Apps with another swipe.

Text Magnifier

In Android P we've also added a new Magnifier widget, designed to make it easier to select text and manipulate the text cursor in text. By default, classes that extend TextView automatically support the magnifier, but you can use the Magnifier API to attach it to any custom View, which opens it up to a variety of uses.

Background restrictions

We're making it simple for users to identify and manage apps that are using battery in the background. From our work on Android Vitals, Android can detect battery-draining app behaviors such as excessive wake locks and others. Now in Android P, Battery Settings lists such apps and lets users restrict their background activities with a single tap.

When an app is restricted, its background jobs, alarms, services, and network access are affected. To stay off of the list, pay attention to your Android Vitals dashboard in the Play Console, which can help you understand performance and battery issues.

Background Restrictions ensures baseline behaviors that developers can build for across devices and manufacturers. Although device makers can add restrictions on top of the core set, they must provide user controls via Battery Settings.

We've added a standard API to let apps check whether they are restricted, as well as new ADB commands to let you manually apply restrictions to your apps for testing. See the documentation for details. We also plan to add restrictions related metrics to your Play Console Android Vitals dashboard in the future.

Enhanced audio with Dynamics Processing

Android P introduces a new Dynamics Processing Effect in the Audio Framework that lets developers improve audio quality. With Dynamics Processing, you can isolate specific frequencies and lower loud or increase soft sounds to enhance the acoustic quality of your application. For example, your app can improve the sound of someone who speaks quietly in a loud, distant or otherwise acoustically challenging environment.

The Dynamics Processing API gives you access to a multi-stage, multi-band dynamics processing effect that includes a pre-equalizer, a multi-band compressor, a post-equalizer and a linked limiter. It lets you modify the audio coming out of Android devices and optimize it according to the preferences of the listener or the ambient conditions. The number of bands and active stages is fully configurable, and most parameters can be controlled in realtime, such as gains, attack/release times, thresholds, etc.

To see what you can do with the Dynamics Processing Effect, please see the documentation.

Security

Biometric prompt

Android P provides a standard authentication experience across the growing range of biometric sensors. Apps can use the new BiometricPrompt API instead of displaying their own biometric auth dialogs. This new API replaces the FingerprintDialog API added in DP1. In addition to supporting Fingerprints (including in-display sensors), it also supports Face and Iris authentication, providing a system-wide consistent experience. There is a single USE_BIOMETRIC permission that covers all device-supported biometrics. FingerprintManager and the corresponding USE_FINGERPRINT permission are now deprecated, so please switch to BiometricPrompt as soon as possible.

Protected Confirmation

Android P introduces Android Protected Confirmation, which use the Trusted Execution Environment (TEE) to guarantee that a given prompt string is shown and confirmed by the user. Only after successful user confirmation will the TEE then sign the prompt string, which the app can verify.

Stronger protection for private keys

We've added StrongBox as a new KeyStore type, providing API support for devices that provide key storage in tamper-resistant hardware with isolated CPU, RAM, and secure flash. You can set whether your keys should be protected by a StrongBox security chip in your KeyGenParameterSpec.

Android P Beta

Bringing a new version of Android to users takes a combined effort across Google, silicon manufacturers (SM), device manufacturers (OEMs), and carriers. The process is technically challenging and can take time -- to make it easier, we launched Project Treble last year as part of Android Oreo. Since then we've been working with partners on the initial bring-up and now we're seeing proof of what Treble can do.

Today we announced that 6 of our top partners are joining us to release Android P Beta on their devices -- Sony Xperia XZ2, Xiaomi Mi Mix 2S, Nokia 7 Plus, Oppo R15 Pro, Vivo X21UD and X21, and Essential PH‑1. We're inviting early adopters and developers around the world to try Android P Beta on any of these devices -- as well as on Pixel 2, Pixel 2 XL, Pixel, and Pixel XL.

You can see the full list of supported partner and Pixel devices at android.com/beta. For each device you'll find specs and links to the manufacturer's dedicated site for downloads, support, and to report issues. For Pixel devices, you can now enroll your device in the Android Beta program and automatically receive the latest Android P Beta over-the-air.

Try Android P Beta on your favorite device today and let us know your feedback! Stay tuned for updates on Project Treble coming soon.

Make your apps compatible

With more users starting to get Android P Beta on their devices, now is the time to test your apps for compatibility, resolve any issues, and publish an update as soon as possible. See the migration guide for steps and a recommended timeline.

To test for compatibility, just install your current app from Google Play onto a device or emulator running Android P Beta and work through the user flows. The app should run and look great, and handle the Android P behavior changes properly. In particular, pay attention to adaptive battery, Wi-Fi permissions changes, restrictions on use of camera and sensors from the background, stricter SELinux policy for app data, and changes in TLS enabled by default, and Build.SERIAL restriction.

Compatibility through public APIs

It's important to test your apps for uses of non-SDK interfaces. As noted previously, in Android P we're starting a gradual process to restrict access to selected non-SDK interfaces, asking developers -- including app teams inside Google -- to use the public equivalents instead.

If your apps are using private Android interfaces and libraries, you should move to using public APIs from the Android SDK or NDK. The first developer preview displayed a toast warning for uses of non-SDK interfaces -- starting in Android P Beta, uses of non-SDK interfaces that are not exempted will generate errors in your apps -- so you'll now get exceptions thrown instead of a warning.

To help you identify reflective usage of non-SDK APIs, we've added two new methods in StrictMode. You can use detectNonSdkApiUsage() to warn when your app accesses non-SDK APIs via reflection or JNI, and you can use permitNonSdkApiUsage() to suppress StrictMode warnings for those accesses. This can help you understand your app's use of non-SDK APIs -- even if the APIs are exempted at this time, it's best to plan for the future and eliminate their use.

In cases where there is no public API that meets your use-case, please let us know immediately. We want to make sure that the initial rollout only affects interfaces where developers can easily migrate to public alternatives. More about the restrictions is here.

Test with display cutout

It's also important to test your app with display cutout. Now you can use several of our partner devices running Android Beta to make sure your app looks its best with a display cutout. You can also use the emulated cutout support that's available on any Android P device through Developer options.

Get started with Android P

When you're ready, dive into Android P and learn about the many new features and APIs you can take advantage of in your apps. To make it easier to explore the new APIs, take a look at the API diff reports (API 27->DP2, DP1->DP2) along with the Android P API reference. Visit the Developer Preview site for details. Also check out this video highlighting what's new for developers in Android P Beta.

To get started with Android P, download the P Developer Preview SDK and tools into Android Studio 3.1 or use the latest version of Android Studio 3.2. If you don't have a device that runs Android P Beta, you can use the Android emulator to run and test your app.

As always, your feedback is critical, so please let us know what you think — the sooner we hear from you, the more of your feedback we can integrate. When you find issues, please report them here. We have separate hotlists for filing platform issues, app compatibility issues, and third-party SDK issues.

Hello World, AndroidX

Posted by Alan Viverette (/u/alanviverette), Kathy Kam (@kathykam) , Lukas Bergstrom (@lukasb)

Today, we launch an early preview of the new Android extension libraries (AndroidX) which represents a new era for the Support Library. Please preview the change and give us your feedback. Since this is an early preview, we do not recommend trying this on any production projects as there are some known issues.

The Support Library started over 7+ years ago to provide backwards compatibility to framework APIs. Over the years, the library has grown to include device-specific UX, debugging, testing and other utilities. The adoption of the Support Library has been phenomenal; most Android apps use the Support Library today. We want to increase our investment in this area, and it is critical that we lay a solid foundation.

In that vein, we took a step back and chatted with many of you. The feedback has been consistent and unanimous; the organic growth of the library has become confusing. There are components and packages named "v7" when the minimal SDK level we support is 14! We want to make it clear for you to understand the division between APIs that are bundled with the platform and which are static libraries for app developers that work across different versions of Android.

With that in mind, say "Hello World" to "AndroidX". As previously noted in the Android KTX announcement, we are adding new features under this package, and updating some existing ones.

android.* vs androidx.* namespaces

Writing Android apps means depending on two kinds of classes:

  • Classes like PackageManager, which are bundled with the operating system and can have different APIs and behavior for different Android versions
  • Classes like AppCompatActivity or ViewModel, which are unbundled from the operating system and ship in your apk. These libraries are written to provide a single API surface with behavior that's as consistent as possible across Android versions.

Many times, unbundled libraries can be a better choice, since they provide a single API surface across different Android versions. This refactor moves the unbundled libraries - including all of the Support Library and Architecture Components - into the AndroidX package, to make it clear to know which dependencies to include.

Revised naming for packages and Maven artifacts

We redesigned the package structure to encourage smaller, more focused libraries that relieve pressure on apps and tests that aren't using Proguard or Multidex. Maven groupIds and artifactIds have been updated to better reflect library contents, and we have moved to prefixing library packages with their groupId to create an obvious link between the class that you are using and the Maven artifact from which it came.

Generally, you can expect the following mapping from old to new packages:

Old New
android.support.** androidx.@
android.databinding.** androidx.databinding.@
android.design.** com.google.android.material.@
android.support.test.** (in a future release) androidx.test.@

The Architecture Components libraries have also been moved under androidx and their package names simplified to reflect their integration with core libraries. A sample of changes to these libraries:

Old New
android.arch.** androidx.@
android.arch.persistence.room.** androidx.room.@
android.arch.persistence.** androidx.sqlite.@

Additionally, following the introduction in 28.0.0-alpha1 of Material Components for Android as a drop-in replacement for Design Library, we have refactored the design package to reflect its new direction.

For a complete listing of mappings from 28.0.0-alpha1 (android.support) to 1.0.0-alpha1 (androidx), please see the full AndroidX refactoring map. Please note that there may be minor changes to this map during the alpha phase.

Per-artifact strict semantic versioning

Starting with the AndroidX refactor, library versions have been reset from 28.0.0 to 1.0.0. Future updates will be versioned on a per-library basis, following strict semantic versioning rules where the major version indicates binary compatibility. This means, for example, that a feature may be added to RecyclerView and used in your app without requiring an update to every other library used by your app. This also means that libraries depending on androidx may provide reasonable guarantees about binary compatibility with future releases of AndroidX -- that a dependency on a 1.5.0 revision will still work when run against 1.7.0 but will likely not work against 2.0.0.

Migration from 28.0.0-alpha1

Moving your app from android.support to androidx-packaged dependencies has two major parts: source refactoring and dependency translation.

Source refactoring updates your Java code, XML resources, and Gradle configuration to reference the refactored classes and Maven artifacts. This feature is available in Android Studio Canary 14 for applications targeting Android P.

If you depend on a library that references the older Support Library, Android Studio will update that library to reference androidx instead via dependency translation. Dependency translation is automatically applied by the Android Gradle Plugin 3.2.0-alpha14, which rewrites bytecode and resources of JAR and AAR dependencies (and transitive dependencies) to reference the new androidx-packaged classes and artifacts. We will also provide a standalone translation tool as a JAR.

What's next?

We understand this is a big change for existing projects and codebases. Our intention is to provide a strong foundation that sets Android library projects up for more sustainable growth, better modularity, and smaller code size.

We hope that these changes also make it easier for developers to discover features and implement high-quality apps in less time; however, we understand that migration takes time and may not fit into everyone's production schedule. For this reason, we will continue to provide parallel updates to an android.support-packaged set of libraries for the duration of the P preview SDK timeframe. These updates will continue the 28.0.0 versioning scheme that began with 28.0.0-alpha1 in March 2018, and they will continue to be source-compatible with existing projects that depend on the android.support package.

The stable release of 28.0.0 will be the final feature release packaged as android.support. All subsequent feature releases will only be made available as androidx-packaged artifacts.

We'd love to hear from you as we iterate on this exciting future. Send us feedback by posting comments below, and please file any bugs you run into on AOSP.

We look forward to a new era of Android libraries!

Say Hello to Android Things 1.0

Posted by Dave Smith, Developer Advocate for IoT

Android Things is Google's managed OS that enables you to build and maintain Internet of Things devices at scale. We provide a robust platform that does the heavy lifting with certified hardware, rich developer APIs, and secure managed software updates using Google's back-end infrastructure, so you can focus on building your product.

After a developer preview with over 100,000 SDK downloads, we're releasing Android Things 1.0 to developers today with long-term support for production devices. Developer feedback and engagement has been critical in our journey towards 1.0, and we are grateful to the over 10,000 developers who have provided us feedback through the issue tracker, at workshop events, and through our Google+ community.

Powerful production hardware

Today, we are announcing support for new System-on-Modules (SoMs) based on the NXP i.MX8M, Qualcomm SDA212, Qualcomm SDA624, and MediaTek MT8516 hardware platforms. These modules are certified for production use with guaranteed long-term support for three years, making it easier to bring prototypes to market. Development hardware and reference designs for these SoMs will be available in the coming months.

New SoMs from NXP, Qualcomm, and MediaTek

The Raspberry Pi 3 Model B and NXP i.MX7D devices will continue to be supported as developer hardware for you to prototype and test your product ideas. Support for the NXP i.MX6UL devices will not continue. See the updated supported platforms page for more details on the differences between production and prototype hardware.

Secure software updates

One of the core tenets of Android Things is powering devices that remain secure over time. Providing timely software updates over-the-air (OTA) is a fundamental part of that. Stability fixes and security patches are supported on production hardware platforms, and automatic updates are enabled for all devices by default. For each long-term support version, Google will offer free stability fixes and security patches for three years, with additional options for extended support. Even after the official support window ends, you will still be able to continue to push app updates to your devices. See the program policies for more details on software update support.

Use of the Android Things Console for software updates is limited to 100 active devices for non-commercial use. Developers who intend to ship a commercial product running Android Things must sign a distribution agreement with Google to remove the device limit. Review the updated terms in the Android Things SDK License Agreement and Console Terms of Service.

Hardware configuration

The Android Things Console includes a new interface to configure hardware peripherals, enabling build-time control of the Peripheral I/O connections available and device properties such as GPIO resistors and I2C bus speed. This feature will continue to be expanded in future releases to encompass more peripheral hardware configurations.

Production ready

Over the past several months, we've worked closely with partners to bring products built on Android Things to market. These include Smart Speakers from LG and iHome and Smart Displays from Lenovo, LG, and JBL, which showcase powerful capabilities like Google Assistant and Google Cast. These products are hitting shelves between now and the end of summer.

Startups and agencies are also using Android Things to prototype innovative ideas for a diverse set of use-cases. Here are some examples we are really excited about:

  • Byteflies: Docking station that securely transmits wearable health data to the cloud
  • Mirego: Network of large photo displays driven by public photo booths in downtown Montreal

If you're building a new product powered by Android Things, we want to work with you too! We are introducing a special limited program to partner with the Android Things team for technical guidance and support building your product. Space is limited and we can't accept everyone. If your company is interested in learning more, please let us know here.

Additional resources

Take a look at the full release notes for Android Things 1.0, and head over to the Android Things Console to begin validating your devices for production with the 1.0 system image. Visit the developer site to learn more about the platform and explore androidthings.withgoogle.com to get started with kits, sample code, and community projects. Finally, join Google's IoT Developers Community on Google+ to let us know what you're building with Android Things!

Building for Automotive: A sneak peek at Google I/O 2018

Posted by John Posavatz, Product Manager, Android Auto

Since 2015, Android developers have been building and growing great apps for cars. Drivers are benefiting from thoughtfully designed apps that provide safe and seamless connected experiences, whether they drive one of many Android Auto compatible cars or use the Android Auto app on their phones.

Today, thousands of apps for Android Auto are available through the Google Play Store for millions of drivers in over 30 countries around the world. And because the Google Assistant is available on Android Auto, developers are able to build voice-powered experiences on their apps that let drivers get things done while keeping their eyes on the road.

But it doesn't end there -- great driving apps will soon reach beyond Android Auto users. Last year, carmakers Volvo Cars and Audi announced the development of new connected cars powered by Android. As an important next step, we are now working with Volvo Cars to bring the Play Store and the Google Assistant directly into their next-generation cars, along with Google Maps. The opportunities for developers are endless -- their apps are able to reach millions of Android Auto users today, and drivers of Android-powered cars in the future.

This week at Google I/O, we are sharing some updates that help developers build an even better in-car experience and become a part of the evolving ecosystem. We will be demonstrating those changes in our Sandbox by collaborating with several app developers, including iHeartRadio, Pandora, Pocket Casts, Spotify, Telegram, WhatsApp as well as Google's own apps (including Android Messages, Play Books and Play Music).

New visual templates

First, a fresh new design enables media apps to make their content more accessible through new visual templates. For example, browsable content is placed front and center as soon as you open up an app, enabling you to easily recognize and quickly start listening to songs and podcasts.

Media search enhancements

Second, new search capabilities allow media apps to directly integrate their results into Android Auto. This allows drivers to quickly discover tracks that are related to what they're currently listening to, such as a song's live version, or a song with the same name from a different artist.

Group messaging and RCS

Finally, we now support group messaging and RCS. Using the Google Assistant, you can easily communicate with a group of friends while keeping your hands on the wheel.

If you're attending I/O, come check out the Automotive session at Google I/O on May 9 at 9:30am PST. We will also be displaying three cars in the Sandbox area that showcase different integrations in real life, including a preview of Volvo's future infotainment system displayed in the current XC40. If you're not at I/O, you can still catch the livestream of the session. Developers can also sign up to learn more about the media and messaging updates as we release more information.