Duration 33:52
16+
Play
Video

Android Jetpack: what’s new in Android Support Library

Kathy Kam
TPM Manager at Google
+ 2 speakers
  • Video
  • Table of contents
  • Video
2018 Google I/O
May 8, 2018, Mountain View, USA
2018 Google I/O
Video
Android Jetpack: what’s new in Android Support Library
Available
In cart
Free
Free
Free
Free
Free
Free
Add to favorites
26.5 K
I like 0
I dislike 0
Available
In cart
Free
Free
Free
Free
Free
Free
  • Description
  • Transcript
  • Discussion

About speakers

Kathy Kam
TPM Manager at Google
Aurimas Liutikas
Señor Software Engineer at Google
Alan Viverette
Software Engineer at Google

Kathy Kam is the Android Developer Platform TPM Manager. Her areas of responsibility includes the Android APIs, Libraries, SDK, NDK and Android Studio. She is a recognized expert in API design where she led design on W3C's CSS Grid. Prior to Google, Kathy was the lead Product Manager at Microsoft, launching multiple developer platforms. Kathy has a B.S. in Computer Engineering and Mathematics from University of Michigan, Ann Arbor.

View the profile

Aurimas is a software engineer on the Android team. In this role, he focuses on androidx (formerly known as Support) libraries. Aurimas has a bachelor's degree in Computer Science and Engineering from Bucknell University.

View the profile

Alan leads the Android Support Library team at Google, focusing on improving the developer experience through libraries and tooling.

View the profile

About the talk

Get to know AndroidX -- the new name and packaging for the Android Support Library -- the foundation for Android libraries in Jetpack, and learn about features available in the 1.0.0 release.

Share

Detect lead for the Android support Library every time traffic Tampa technical program manager for the support library in the latest version of the Android support Library as well as some new things that you can look forward to in the future. This beautiful spring day in Mountain View, California. We're going to start with a little bit of spring cleaning and talk about some technical debt that has been building up in the support Library. Run Twitter run stack Overflow Weir on Reddit. Maybe won't read it a little bit

too much but we noticed some basic aspects of the support Library. There were a little bit what's a messy so we've reached out and spoken with developers and try to find out some ways that we can improve the basics of support library and lay a strong foundation for future work. We got a lot of good feedback some very high-level some very specific. We know about the issues with showing and hiding the ime, but we drilled down to the basics. We got feedback on our Maven Packaging Star artifact in package names are Java packages have become a little bit confusing is support library has

aged. And in general we built up a lot of technical debt. So like last year we're going to talk about what's old in the Android support Library first. So we started in 2011 with support V4 and as I'm sure everyone here knows that provided backward compatibility for devices running SDK for the first public release of Android when we grew we game libraries for watch components car component testing support for SDK 13411. So we have a lot more than just backwards compatibility

now. But we still got these artifact name. So we've got support before everyone's going with that support B13. Who knows? What's instaport B13? Literally less than 10 people RMS nose. So support B13 at this moment contains nothing because our minimum SDK for everything is 14 B13. Just redirect to be 4 before actually redirect to a bunch of other components. These are both just umbrella artifacts on Maven. So why do we have all of these weird versioning

names in our Maven artifacts and dinner package names? Well, they're kind of hard to change but these are confusing. It's not a great place to start if you're new to Android development. Girls have a lot of versions of all of these libraries. No recommendation is something that was added back in 23 and hasn't changed a lot since then so we have 30 versions of basically the exact same Library. What is the burgeoning scheme mean here? 24 means it was released Google IO. When is the K24 came out? We had an alpha one corresponding with the pup first public release

dp1 Alpha 2-4 dp-28 at 1:43, but it doesn't make a lot of sense for us to be corresponding to just the io releases wouldn't be great. If we had Alpha and beta releases for every version of the support library and wouldn't it be great if we didn't have to do that for every single Library even if it hadn't changed so you may have seen nothing like a 24000 that should have had a little bit more testing. Maybe they should have been a beta-2 there or maybe you pulled in 25.4 and found some bugs that really should have been an alpha. So we've been doing a lot

better about testing but would it be great if our. Zero releases weren't still Alpha quality. So today we're going to focus on fixing how we structure our libraries How we handle changes to them? And how we ship them to developers and we're using this to form the foundation for Jetpack. Amber calling it Android extension libraries or Android extra short. So welcome to what's new in Android X will be talking about foundational features new feature features and what you can expect from us in the future first though. I'd like to talk about the relationship between jet pack

which everyone may remember from the keynote and Android X. So jetpack is a set of guidance recommended libraries in tools. And this is going to teach you how to create good apps. This may include libraries that are in Android X. This may eventually include libraries aren't in Android X and his guidance changes and evolves. You may see that some things in Android X become deprecated and are no longer part of the jetpack recommendations. Also, it's got this cute logo. And the other hand is the libraries themselves. These are guarantees about versioning API surface

dependency structure and we do not have a cute logo. So what exactly is going to be changing? We're going to have to be logical smaller more scoped artifacts. So for example, if you're looking for viewpager, it's going to be in the viewpager artifact rather than support before before split that we did last year where we split out to Corey Y and a number of other artifacts we've done that again this year. So we have smaller artifacts. If you need viewpager, you just pulling viewpager. You don't point a bunch of other widgets that you may not need. This

is of course not breaking like the split that we did last year. So if you pull in support before you still get all of that umbrella of libraries if you pulling for you I can you still get viewpager and everything else, but you also have the option of just pulling in exactly what you need. Here's a split of the libraries of this is just a sample. So you'll see that support compat has been broken down into collections disappear Java Library. It's a jar instead of an AR. It has the resources you can use it with those tests because it doesn't have any dependencies on the Android

package is the backwards compatibility to from support before you're going to see less of the compact monitor in the future as support as Android X is becoming the primary development surface for a lot of framework apis. Refresh layout you pull it exactly that. You don't get anything that you didn't need. Also moving to versioning that makes more sense. So instead of Monolithic releases that are tied to Google IO, we're going to reset from 28 to 1. Oh and the major version number now actually

mean something so previously we would break binary compatibility on any minor version bump and if you're using a library to depends on the specific version of support library has to be really problematic. You may not even find out until run time that some method signature that a library depends on his changed our move to strict semantic versioning with Android X means that you can always expect the major version number to indicate binary compatibility anything in a 1.4 version of the library anything with a 1.4 dependency on the library for example would be compatible with

1.5 1.6 all the way up until 2. Oh We're also going to be doing for artifact versioning and release. So instead of a monolithic release if we have a bug fix for recyclerview, you release a. One of just the recyclerview library. You only have to pull one new artifact. And if you don't need it, you don't have to pull it in. So it's going to be very low effort on the part of the developer. Right. I want to make it easy to know what's inside each artifact. So as I mentioned Armada artifacts are now finderscope to they correspond to Features instead of very broad swaths of resemble

all of support before we have a consistent scheme of Android X. Feature. Package and class according to layer in functionality at our Maven Maven naming scheme reflects. This our group ideas are going to be Android X. Feature. This will correspond directly to the Java package. The artifact ID will be the feature and if there's a sub teacher for example recyclerview selection, you will see Android X. Recyclerview colon recyclerview selection. Also noticed that we've moved all of the v7v for explicit

SDK require explicit backwards compatibility or explicit requirements. So our Minister care requirement is built into the Android manifest for these libraries, and we also make heavy use of the requires API annotation. So you may run into methods that require May return a new object. They may see something that returns compat something to return to the actual object and you can call that if you're on a newer platform. Pretzel what's an example of that example of some libraries that you may already be

using redefine everything under the Android next top level package. So everything that was in combat Android support is now an Android extension Library everything from Android. Arch is now an Android extension library for the most part. We're preserving the names, but you'll see some simplifications. So I Android Archer persistence room for example is now just room when you're looking for room. You can find it very quickly. What's a down on support compat and cardview V7 specifically and take a look at some of the classes. So Bill can Pat his move from an explicit

V4 support to Android 400 s gold Compact and in the future, you'll actually see a lot less of the compact suffix on classes curved TV 7 is now just card widgets and the class is part of you. You'll find other supporting classes in Parkview. Util Etc. Hopefully this isn't too shocking. I think this is a very long awaited refactoring that we've really been wanting to do for a long time. And you might be wondering how do I get that? So it will hand over your arm is going to walk you through what it looks like to migrate your application. Hello

there, right? Thanks Alan. I will walk you guys through our migration story and how you want to get to the Android X Library usage. So first things first, I see using Android studio. We will be providing an automated tool for migrating over. It's the stool is available starting to Android Studio 3.2 Canary 14 that shift yesterday. The song I Need a tool. Show me the tool will be in the existing verse protector menu that you probably hopefully love we had it in you option that's gold refractor to Android X

and the division single click will go and identify all the usages of Android support Library Old glasses and it will pull them up in the review pain where you going to be able to see what has changed and what were about my grade for you and after review you feel like you're attacked her and we'll go ahead and refactor and what this will handle it will go handle your source code including your counseling classes. I will handle simple Bill scripts unless you have something more complex in which case we're going to publish maps of old artifact of the new artifact so you can do go

migration in the sleigh and more manual way. A migration I will also handle resources that just your layout files. And then finally but not least. What you going to have is we going to handle out migration of binary dependencies for a ours and jars. We know that many of you use third-party libraries that depend on Sabor library and it could be blind or many other libraries also to help you with that. We wrote a tool Uncle Jada Fire and this tool performs binary translation using ASM which jumps into the jar and goes and rewrites all the uses

of the old Square library to become the new support library has handles code inside of the jar. I'd handled XML resources it even handles proguard files. We will also publish a stand-alone jar Ave. You can run manually if you'd like to have the checked-in versions of these three bills that you depend on. And now let's jump to the laptop where I'm going to give you a demo of how this tool works and hopefully the devil Works, beautifully. Square cereal All right, let's jump to the laptop. Right also hear you're looking at the Topeka Android app. It's available on the

Google samples GitHub page. It's nothing super amazing. This is just using standard components and showing examples of how it works as you seen the Android emulator. I'm running this app at work so you can click on things. But now what are we going to do? We going to jump into the refectory menu hit the roof actor to Android text which of this is going to do is going to go jump in and search for all uses of older adults for Library classes in both XML Java and in all the other places are we migrate for you? And I chords and searching for is going to present all the things that is it

supposed to just for you to my grade. And in this case. I'm looking at the specific sign and fragment class and you can see there's a bunch of use of support library. And what is going to happen when I hit you recycle sure. It will go and rewrite all of these and including Bill step files and everything and of course griddle needs to go in sink again now because we just changed all of A dependencies in the class pass need to be reloaded. So now that's what your twiddle your thumbs a little bit and wait for a studio to do its thing and now we are using new stuff. And now when I hit build

and install hopefully in a few seconds at home, you probably would go grab a coffee. But here we can do that on the stage, but he will go and install it on emulator any moment now, I will start a little bit longer by staying over words. Haha, and now you see this is us a map using a brand new Android X Library and migration was fairly painless solution back to the slide. All right, of course some of you are now using Android studio and for you for those people we will be providing a giant CSV file that has a mapping of

old glass to the new class and that in addition to the Standalone Jetta fire tool. You should be able to hook up together in your bill system and your ID to do the migration manually. If you're not using Studio Austin summary, we are providing any schools in Android Studio 3. To Canary 14 & Fire's already in Google maven. This is coming in really hot. Even the demo that I was using is actually not using Canary 14 is using for nearly fifteen that shipping next week because we found bugs when we're trying to do the demo, so, please

wait until January 15th to start using this but when you do in Canary 15, please take a look at it right to migrate your project and you find any issues with it. Please file bugs are very we want us to make it as easy as possibly want you to migrate and start using all the new stuff. However, you know migration takes time. So we will still ship Android support Library 28.0 alongside of Android X. So this is kind of like a little bit of time length for you to kind of move forward.

And if you want to know a little bit more of how this works behind the scenes inside of Android Studio, there will be a talk about Android build build system at 6:30 and in this room, so hopefully can go and take a look. So it's not all about refactoring. We also added new features and I'm going to talk to you walk you through some of these. The first picture I want to talk about is recyclable selection. This is a library that will allow you to handle item selection a lot easier. It will help you handle motion events in touch events and convert them into selection in the

recycle of you. This is a fairly flexible Library where allows for a custom layoff managers and a lot of custom actions that you can do them for Wednesday how you use it? As you can imagine you have a tendency to build a griddle file an important thing to note here is that we are using the new Android X artifact. This is the same stuff that Alan was talking about So for the setup, what you need to do is you when I scraped a new chapter in the adapter important thing is that they use a stable IDs will using a stock grid layout manager and we said both of these on the

recyclerview. There's no selection code just yet. We're just doing the basic recycling you set up. The adapter is a said again. Nothing super exciting. The only important thing here is that we're doing stable IDs and this allows for consistent mapping for my Deeds of the item. And the next one week jump back the activity. We stop setup selections Libras is key provider in this in conjunction of stable IDs will allow for a quick nap in between the ideas in the items that handle the selection by the selection Library. And now would we need to set up is this election tracker which

actually is the actual Machinery behind the scenes and we pass in recyclerview the key provider both of these that we just created and then my detailed look up and I need to look up is actually a fairly simple class. You need tools right only one method and in the side of that one you were time. It returned item details and that Returns the position and the selection key for the item that is for the given motion event. And finally, I recycle tree has no default selection mechanism. So what you have to do is you have to handle it them on bind. So there you might want

to change the background off of you or you can use it by setting activate State and to get activate estate working you use background for the view and a background is a selectable drawable that has an activated state which will allow to indicate do you get the item has been selected? This is a Basics. Obviously Ivory has a lawn mower. You can set up band selection. You can add custom selection areas. You can have items that are not Square. They can have circular handling and stuff like that. There's a lot of stuff you can do this library on a new form part of this

life. That's my dog jack. All right, I'll Never sing that we added to recyclerview is a list adapter. And what does he does for you? Is it helps you to work the recycler views that change the content overtime. So what you all you need to do is submit a new list. We run a Disk Utility tool behind the scenes for you on a background thread and then we run the animation based on how delicious changed in this is all I handled be a very simple API. I'm going to walk you through it. So what you need to do is you create a dip call back and if all that has to implement to Method first

one make sure that the items are the same where you compare that item IDs on the second one. You want to check the fat content is the same where you do a deeper comparison essentially equals in Java and then there is there is a changed will know how to Crossfade your item from one to the next. In any adapter what you need to do and I'm buying you just call get item. I need to do to your regular binding and then that's that's all you need to do to get the animation working and then I highly complex code any activity you call submit list of your list and that's if you're done

notes. This works really well with live data and I Rex. So if you need to do a lady more advanced adapter wheels of a base adapter called a stimulus differ, so if you need to do that, just go and look into that. If you would like to know more about list adapter and similar utilities. I see you managed to get the littlest the recyclery on page and talk on Thursday at 2:30. Right. So another thing that we added is Android XML Wicked library. And what allows you to do is to get the API that we added in in webview

on the older version in the backwards compatible way this slavery works on API 21 and newer where we introduce the updatable web you through Play Store so that an API 27 this prevents loading off malicious your else in the web you inside of the application and previously could only use it on Avi 27 and you were but now you are going to be able to use it on older devices. So similarly, we going to a data Gradle dependency to get this working again. We're looking at the Android X artifacts. Hopefully you got this by now

and then we'll check it features available. And if it is with starts a rousing it's as simple as that when you get the paper experience of safe browsing starting VPI, 21 and newer. I'm similarly many other apis if we added since API 21 now will become backwards compatible available to your application. So hopefully you'll check this out. Sunriver library that we rename is custom tabs this Library became Android browser browser has it already implemented is so prone Firefox in Samsung internet all of them implemented and

if you're using it will continue to work the cool thing about this. We added a new feature inside of the library, which is called browser action. And what allows you to do is is allows you to hook into the context menu off the browser. So for example, now your Reddit app can finally open a LinkedIn incognito tab, which can be very handy. It works in Chrome starting from 66 and it will start working on other browsers when they adopted So I guess you use this it's fairly simple. Are you set up intense intense for your browser browser browser action

items? This is an optional if you don't need any extra ones in your dialogue, you don't have you can skip this for another optional Park you setup is. Browser action tracking so what this allows you to do. So you can see what user ended up selecting inside of the dialogue. And then finally you just fire up the browser actual dialogue and anyone that does something like this and then you can do you know what Dish channel actions yourself or you can hook into the browser. Where's previously you weren't able to do these to be a simple intense because browsers weren't interested in exposing a

lot of functionality directly. Another Library what I'm going to talk about is he freighter he stands for high-efficiency image format and we introduce the 4th to the platform for Heath in Android p and alongside. We're launching this library that allows you to take bike buffers surfaces in bitmaps and write them to the file currently. It is only API 28 and newer. They're not super useful, but we are working on a backboard that will allow you to use it on older versions. Again usage is very simple you fire up the Builder to create a new keefrider object in there.

You can set up a bunch of options likes image size or quality you hit build on once you have you start you start writing to it and you put in Bedknobs, and once you're ready and you're done with and you want to write it out to disc, are you call stop at the time out in the time I have can be zero. If you want to have an indefinite wait an important part here is you want to do this work on it Off of You by Fred because you're going to be doing a disc and to tell you a little bit more about other features in Android X by Kathy. Thanks.

Thanks, Thomas. So the next thing I know I talked about it because we add an Android access if he could cause slices like this is the future that allows you to display content outside of your app. So the goal here is to have one reusable API that both the system and other apps can request content from your app today. We have already integrated research. I'll go as soon as look at the invitation with notification long. Press not even home screen in the future so

that when you have kind of Life content, you can display it in a rich and flexible layout and the content is interactive because we allow you to add existing controls like witches actually would just like slightest tacos at Orange Grove you're so that together with inline actions or even deep links in GIF app. You can also choose to integrate your slices with search. So a user can see the display by searching your name or even general terms that give register. This is a win-win for both

uses and the apps because you said can get rich like that immediately and for your app to reach millions of users because this is implemented in Android is usable immediately after 8:19. So let's take a look at how you can use it. Thought you would expect we have to do the first import the library says 3 Libras unit import and here we importing from Android it the first is to slice builders that includes message to Bill content in a template format. The Nixon Library is a slight view this contains method so that you can present the

content and the lost library to import. It's like a score that contains method for the new build a slice you have to find a slide and pool at the fly and handles by section. Let's take a look at how we can do it. So the first thing we need to do is to let the pup system all the apps know that you have slices to provide. So you do that by implementing you'll slice up provider. So you register your flight. Next you'll have to extend from the flight provider and Implement just like provider you can have multiple slices for your app. So he's this is where

the business logic happens. When another F1 to call get your slices you get a call on on Vine slight there. You are. I have to slice being a question and you have to return your ass like an idiot Lee for any content that needs to be loaded should be kicked off and you will return it and don't slight. So let's go construct a slice here and we get able to put Tuckett with several classes include Roto-Rooter. The show we can use the list Builder to add a

very simple header the header contains a title and subtitle and you see the method and her that has to hit her. Then build on top of it we could use the Bridge Road Builder first. We get the latest weather information and then we can look through it adding a cell to the Bridge Road Builder and by just calling at the bottom with a pence the rest of the flight to the header. So why don't you get here is that based on screen real estate if it is small with stroller shortcut slice slice pick up an image from your flight. So because we have the weather

image or pick that up, but if you didn't have an image will show your app icon and then if the screamers they only allow for small slice, it will be the head of that shown and finally it has enough space. We will show the food slice. Set alarm more about slices. There was a talk this morning that you can review. I only just cover very basic of it and you can learn more about templates permission and integrating search. And you can also meet the team at the office hours 10 tomorrow morning at 10:30. The next topic. I want to talk about its material component. We

launched material components for Android back in support Library 28. 0.0 Alpha One in March, and we've also watch it and tried it yesterday. So if you know material theming is assigned to support great user experience with made a lot of improvement since so one of the first things I've done as part of the Android refracturing is that instead of being an Android that support. Design. They've been with moved it to calm. Android would work well for you. So we made them

more usable and accessible with updated styling so that you can fed express your brand and included new UI component. Let's take a look. Here is an overview of the human capability on your right. There's a very brand agnostic Baseline. I'm on your left. There is the Google Brandon from the theme so that it makes it super easy for you to have a flight teeming. Let's walk through some of the same code as you would expect. We'll have to import the library here note that it is coming from, the fugoo. Android the material. and I need the

phone to use a face like theme you defined a kind of set the theme to be material components. Light. This is the kind of agnostic theme for you to start with. And then we provide a whole bunch of attributes that you can override so that you all look at which it's within the app can pick up. So here we are divine define attributes for different text Style with summons that comes out of box, but you can also to find your own and although custom widget if you have it can also pick up

the theme. So let's take a look at some of the components that we have updated first. This text field. We've done a lot of research and we have improved the touch Target making it more easier for input and making it more usable and accessible. We've also add a new states to it which includes Focus de terre State disabled and text counter. So we've been through all of it from the start to make your life easier. Next up is parent. I think until you can just use fun in the way you used today by sending the material component lights team will automatically in

flight this to the material but the understand now seen and pick up all the attributes that you have said previously in your team file. You can also use custom attributes with these And then we also providing to update of bar. So you the first is the bottom at far the bottom app bar allows you to add app actions into your app of what we have done here is that we have allowed you to have bigger. So we won't allow you to position the your actions anywhere you want along the bottom at far. So here we have a fat that is

centered and then can be animated to be right-aligned. The other Bottom bar that we have updated is the bottom navigation bar. So just to clarify that the actions and the bottom navigation bar is four different sections within your ass we did not recommend these metaphors so that we provide food for you to choose from so you can build yeah. The pulling all of this together is the material cardview that is a rapper on the existing cardio in the support library or Android it with simplify how this was built. So that has let's chat elevation and Shadow and also pulled

from the theme in color. So here you can see all the elements coming together with the text button and all that in the material card you with this component. You will have to define a using material cardio explicitly. We're looking to see whether we can integrate it at 12. So what that you can learn more about this in stage 8 at 4:30 on Housing Court. What's new with material design in your coat base? An Android it says only one part of Jetpack jetpack is a set of components to the guidance to help you great the great Android apps quickly and

easily. So we're at the store, but we're four more talks a lot for you to learn more about jetpack. So, but that thank you Alan Aramis, and I will be hanging out at the end Road 10th right over there that will help to see and talk to you. I love you. Thank you.

Cackle comments for the website

Buy this talk

Access to the talk “Android Jetpack: what’s new in Android Support Library”
Available
In cart
Free
Free
Free
Free
Free
Free

Access to all the recordings of the event

Get access to all videos “2018 Google I/O”
Available
In cart
Free
Free
Free
Free
Free
Free
Ticket

Interested in topic “Software development”?

You might be interested in videos from this event

September 28, 2018
Moscow
16
159
app store, apps, development, google play, mobile, soft

Similar talks

Alberto Medina
Developer Advocate at Google
+ 1 speaker
Thierry Muller
Engineering - Developer Relations Program Manager at Google
+ 1 speaker
Available
In cart
Free
Free
Free
Free
Free
Free
Lynn Jepsen
Tech Lead at Google
+ 1 speaker
Adrian Secord
Senior Software Engineer at Google
+ 1 speaker
Available
In cart
Free
Free
Free
Free
Free
Free

Buy this video

Video

Access to the talk “Android Jetpack: what’s new in Android Support Library”
Available
In cart
Free
Free
Free
Free
Free
Free

Conference Cast

With ConferenceCast.tv, you get access to our library of the world's best conference talks.

Conference Cast
558 conferences
22059 speakers
8245 hours of content