Kotlin 2.0, Google IO, Android 15 and More - Philipp's Android News June 2024

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to a new episode of Phillips Android news which is the format where I go over all important changes that somehow affect us Android developers no matter if that's a new cotton version a new Android studio version some cool changes to the Android ecosystem Google Play Changes whatever it is I will research it all for you summarize it in one episode so you can easily follow that once a month and be up to date as an Android dooper so you know which topics actually make sense to dive into and which are rather not so important for you because let's be honest staying up to date as an Andro developer is quite hard and this time for June's episode I will summarize all changes from May and I can already tell you there are a lot of cool changes this time so let's immediately dive into it the first awesome change is that cotland 2.0 is now out so this is actually huge because it brings a lot of cool changes to cotland on the one hand we have a new cotland compiler so jet Prince has been working on the K2 compiler so a second version second generation of the carton compiler which is just much better according to them it promises twice the compilation speed as the previous compiler so we get faster Gradle builds overall but apart from that it also brings some other changes specifically language and coton multiplatform changes one thing you need in order to use this new compiler is you need at least grader version 8.3 or more but if you have that you can run the stable K2 compiler so let's go over which other changes this new compiler brings on the one hand we have lots of smart casting improvements so in case you don't know that smart casting is a feature the compiler can use that if you cast an object object in your code to a specific type then that the compiler is smart enough to recognize that you casted it before and that it can treat this object only as the type of object you cast it it to in the following code so in coton that is typically applied in when expressions for example so you say when animal is dog and if it's a dog then you have access to the bark function for example since the compiler knows okay if it's a dog then it must also have the functions a dog has and with the new K2 compiler there just now improvements to how smart the smart casting feature of the compiler is the detail scenarios in which that now also works can be found on the jet brain site I won't go over that in detail here because those are just a bunch of smaller examples and code Snippets you can go into but be aware there are some improvements now then the new compiler also brings some cotton multiplatform improvements so on Cotton multiplatform we have one common source set so just a folder a directory which contains the code we want to share between platforms so the common code and it has some platform specific sources so one for Android code one for iOS code desktop code web code and so on and previously these sour sets were separated in a project hierarchy but the coton compiler wasn't able to really separate these during compilation and this just could lead you to access a function that is written in the platform specific code from the common code which shouldn't be possible since in the end the common code can't know which platform it's running on and this is now fixed with some redesigns of the compiler then next Up cutland 2.0 also brings a new grle plugin called Power assert and as you can already guess this plugin is useful for testing since when you run an assert like okay this value needs to be true and that assertion fails you normally with a default framework you're not able to tell why that failed so you're required to actually dive into your code and inspect that but with this new power assured plug-in it will just include variable values it will include sub Expressions just in the final lock Trace so you can inspect such failed assertions faster so in the end when a test fails and you're using this grader plugin you will now know better why it failed so how do you now use cotton 2.0.0 and how do you use this new K2 compiler pretty simple the carton version you can just update in your project settings so in the version catalog but in order to also use it with the K2 compiler you need to go to your an Studio settings search for K2 and then there is some kind of checkbox you need to opt in at this present moment all right so much about cotland version 2.0.0 next change Google IO Google IO is a yearly event by Google where they announce all the hottest new from the Android and Google ecosystem and this time there are again some very cool announcements on the one hand and this is one that I'm particularly excited about cotland multiplatform is now officially supported by Google so as you maybe know cotland multiplatform itself is a technology by jet Brint so by the same guys who make these cool idees like Android studio intell and so on but now Google so the company behind Android decided to officially support cotton multiplatform with their jet Peg libraries so that means that all jetp Peg libraries we currently know so things like uh room things like jet Peg view model jet Peg life cycle things like jet Peg navigation compose all those libraries we have in the jetpack set will be gradually migrated to also work for coton multiplatform and they will be maintained by Google and a lot of them already support Carton multiplatform and for those that don't yet the the support will follow in future if we take a look online there have been lots of discussions about okay what does that now mean for flut because flut in the end is a technology owned by Google while cotton multiplatform is a technology not owned by Google and they still decide to support it so flutter developers have been a little bit afraid due to the change but if you say okay that's actually something I'd be interested in in in my opinion about what I think about C multiplatform versus flatter what I think will the future be in regards to crossplatform mobile development then just let me know that down below and I will make a video then the next cool changes on Google IO were changes to Jetpack compose on the one hand we now have a way to implement sheared element transitions on jet in Jetpack compose which I already made a video about so I will keep this a little bit shorter here but there is now a way to have shared element transition so we have one element that transition into another element on a second screen and that is now in beta and then we are finally able to also fully animate list changes in a lazy column Inc compose since previously these list item animations were really limited and now we're able to also animate adding new messages or adding new items to a list removing items from a list and reordering items and in order to use that you can just use the animate item modifier and apply that to the item in your lazy column just make sure you also have keys assigned to your items in the lazy column another change that affs compose is that we can Now display HTML inside of a text composable and the way this works is with annotated strings so annotated strings were the kind of data structure that compose users in order to display formated strings so where parts of the string are bold some parts are italic some parts might have a different color and constructing these annotated strings was always a little bit pain lots of boiler plate code but now there is a way to actually generate such an annotated string out of basic HTML formatting so you can just use annotator string. from HTML paste your formatted HTML code with a text with your normal um I don't know underline tags with your bold tags with a specific color and the from HTML function will then take this HTML code and transform it in in an annotated string which will be displayed in your text composable so you just need less code overall to form a text and compose and we also got two new composes on the one hand the contextual flow row and contextual flow column those are pretty much just two new lay outs which extend the behavior of the already existing flow row and flow column so flow Row in case you are not aware of that is really just a layout uh that um aligns items in that Flor row horizontally at least as long as they fit in a single row If an item does not fit in that single row anymore it will jump to the next line and that was already possible in compose but now with these two contextual flow rows and columns we have the option to also Implement these as a lazy layout so where only those items will be drawn on the screen that that are actually visible then we have another change regarding compose and that is that the strong skipping mode is now enabled and not only enabled but production ready so what the heck is a strong skipping mode that is in the end a new mode the jetp composed runtime will use to allow unstable composable to still be skipped so in the end to really just keep this very short when State composed State changes in the composed hierarchy then the composed runtime will try to figure out which composes actually are affected by that state change which composable need to be recomposed and all those composes that are not affected by that state change which just look exactly as they did before they are skipped but due to the internal workings of how this runtime actually uh checked if certain State changed or not we sometimes needed those stable and immutable annotations on our composed date depending on the data stretches we used and if we didn't do that we just got some performance issues in our code but now with this new strong skipping mode even those composes that use unstable state so state where the composed runtime can tell for sure if it changed or not even those can now be skipped by the composed runtime meaning you will get less recompositions and a better performance overall and we are still not done with composed changes there are more another thing that sounds boring at first but it's actually a really cool and important change is that the composed compiler now moves into the official cotland repository and do you know why that's a cool change because in the past you know when we actually updated our cotton version then that was always coming also with a change in the composed compiler version this is this little field you probably face in Android project like a cotland compos compella extension or so where you always needed to research look up on Google look up in their compatibility map which specific composed compiler version actually matches your cotland version and this is now over because since the composed compiler was moved into inside of the cotland repository that means if there is a new cotton version that's shipped it will automatically also come with a new compos compil version version that's shipped because if a new cotton version is shipped it will automatically come with a new composed compiler version that comes with it so we don't need to specify that version on our own anymore we don't get any build issues because of that that is really great and do you know what I got more compos stuff there is one last super cool thing that I have to share here super cool change regarding compose I also already made a video about that so I will also keep this one short but what should I say guys string routes have an end the official composed navigation library now supports typ safe navigation type safe argument passing it was always such such a pain to set up proper navigation destinations in a composed project with the official navigation Library needed to Define our route pattern we then needed to Define which arguments we had which types this argument had if they were nullable if they had default values we needed to remember the same format our route needs to be in we needed to also uh properly encode maybe strings if they had spaces if if they had slashes in them since our routes were URLs in the end but on Android we are not on web we are on Android and we don't need URLs and now in the official composed navigation Library we have a way to um pass data in a type safe manner that means we Justus Define data classes these data classes have parameters these parameters have specific types they could be nullable could not be nullable they could have default values and then if we want to navigate to that route we can only pass these specific types the route actually needs without running into any weird runtime issues all that works with cotton civilization under the hood so you do need that Gradle plug-in in order to make that work but I think it's best if you just check my recent video about that but I have more I have more not about compost we're done with compost at least the cool stuff about it but we have more nears and the next thing I want to talk about is that the Android 15 version is now in the second beta so Google just announced a few new features the new Android 15 will actually have a few new things that will change for as Developers and I again summarize the most important ones here for you on the one hand we have more limitations as usual there is no Android version that's coming out without more developer limitations and those new limitations mostly affect foreground Services here which have already been limited quite a bit in the past but now there are more limitations to it it's not too bad to be honest so um if we take a look at what those limitations actually are um they only affect data sync and media processing foreground services so data sync should be self-explanatory so when you sync some kind of data to a server and do that in a foreground service or media processing so when you need to process some media files I don't know convert images or whatever that could be these Services now have a time out of 6 hours so that means if you launch a foreground service with one of these two types and it does its job for longer than 6 hours Android will make that service time out and if a foreground service times out that doesn't mean it's immediately killed or so but it will no longer be considered a foreground service by the system so it will just be considered a normal service at that point and normal service serves can be killed much much easier than foreground Services by the system so if your service turns into normal service and the system is then hungry for memory your service can be killed but let's also talk about a cool new change and that is that there is a modernization of the compos canvas going on or just the general Android canvas since that will then give us a 4x4 Matrix which sounds very mathematical and boring but it's really cool because with a 4x4 Matrix what we can do is we can do transformations in the 3D space so what we do on a canvas is usually just drawing something in 2D but with this new Matrix that will allow us to transform specific canvas coordinates in the end to 3D space then the next change that Android 15 will bring is a so-called private space so that means that Android as a system gets it on kind of incognito mode so you can think of this private space as a separate user space so a separate user profile on your Android device which requires authentication so maybe um biometric authentication with your fingerprint or typing a password or so so only the person who should access that private profile is allowed to do so and this private space can be in a locked state so you can actively lock this and that case no apps will be active anymore in that private space and also no apps will be able to send you notifications and that also means that all the settings and recently used apps for the private space won't show up in the uh normal view this suddenly enables completely new typs of apps for Android users but I will personally just use this for family pictures all right last change that's relevant to talk about for Android 15 that is that predictive back gestures are Now the default so predictive back gestures have been announced before already but till now that was always a developer setting you needed to opt into that but now it's the default so what is that actually now Android changes the way how we navigate back in apps so if we navigate back and swipe then with predictive back gestures it gives the user kind of a hint of where they actually get when they perform that back navigation and that's just now the default with Android 15 cool so we're done with Android we're done with a Google IO we're done with cotton 2.0.0 I have one more little category I really want to talk about and that is again for Jetpack compost um it's nothing that was announced during Google iio so I met that a separate category but we have new adaptive layouts and I really like them and I also have made videos about two of those actually already but what does that mean so with Android we have an Adaptive library and that brings mostly layouts that adapt to all those different screen sizes that are out there um so mobile phones tablets foldables I don't know um desktops which by default is of course the pain to support all these and make your UI look good on all of these different screen types but these adaptive layouts do that for you for common types of screens for example for list and detail screens while on mobile devices a list and detail screen is usually just one list screen and one detail screen if we take a look at that on a tablet then there is enough space so we can have list and detail screen on one page so depending on the device you're on the layout will arrange your two screens in the right way so it's nicely visible for the user so you have this new navigable uh list detail Paine scaffold which is a terrible name to be honest but it is how it is um you have some kind of a supporting paint scaffold which is also U which has a similar purpose and you have a navigation Suite scaffold which I also have a video about already um that is a scaffold that will work well with these typical material material 3 navigation components so we have the navigation Bottom bar which is typically used on phones we have the navigation rail which is a rail on the left side of the screen for tablets and we have a navigation drawer which uh is for rather large screens but all those composes have in common that they are meant to navigate between pages and this navigation Suite scaffold will just switch to the right type of navigation composable depending on the right screen size so all in all I think those are really cool changes definitely something I would check out if I were you for example by watching my previous videos and I really tried to not make this episode longer than necessary because there were a lot of more changes but I try to condense what I considered important what I considered exciting into this episode so you are more up to date than before hopefully awesome thanks for watching if you want to learn more about Android more advanced courses you will find them down below as usual and I will see you back in the next video have an amazing rest of your week bye-bye
Info
Channel: Philipp Lackner
Views: 25,646
Rating: undefined out of 5
Keywords:
Id: vcmqD128SJk
Channel Id: undefined
Length: 17min 1sec (1021 seconds)
Published: Wed Jun 05 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.