🆕 Coroutines best practices 📝
We just published a new doc that collects all the best practices we've been advocating for over the years. These patterns can have a positive impact in your app by making it more scalable and testable.
Check it out! 👀
🆕🆕🆕 App Architecture guide 🆕🆕🆕
🗞️ Extra! Extra! Read all about it! 🗞️
We just launched a new guide to app architecture 🚀
This includes best practices and recommended architecture for building robust, high-quality apps.
More in the 🧵👇
This week marks my farewell from Google as a Developer Relations Engineer 👋
I can't help but feel incredibly thankful for the awesome time I've had and the fantastic folks I've had the pleasure of working alongside 🙌
Here's to new adventures on the horizon! 🍻
Hilt is officially out! 🚀
Hilt is Jetpack's recommended library for dependency injection in Android.
Learn more about the launch in this blog post
Starting 🧵 with more info 👇
Learn more about Kotlin
#Flow
with our new documentation 🌟
🌊 Flow Basics - how to create, modify, and collect from flows
🧪 Testing - how to fake flows and assert emissions
🤹♀️ StateFlow and SharedFlow APIs - their role in an Android app
Ever wondered what Dagger does under the hood? 🤔
Every annotation has a _point_ 🔍! Check out this cheatsheet to understand how Dagger interprets them and the code it generates for you 👩🔧
Join
@manuelvicnt
as he gives us the lowdown on Coroutines and Flow in Android, including...
📚 Tips for building your own APIs
📚 Differences between collecting a Flow vs observing a LiveData
📚 StateFlow vs LiveData
🤓 And more!
See for yourself →
Deeply grateful for the great feedback my Architecture talk got at
#dcbln22
last week 😇
The recording will be available at some point, but if you want to get the highlights of the talk in written format, check out this thread 🤗
🐝 Exciting personal news! Thrilled to share that I've started a new Android position at
@Bumble_Tech
! 🚀
Joined this amazing and talented team to create incredible experiences for millions of users while empowering fellow developers. Let's build some buzz together! 🐝
We just migrated
#Android
Architecture Blueprints to StateFlow! 💃
🙅 No more LiveData in the data layer
🌊 Reactive ViewModels that combine different streams of data to produce the UiState
🫂 UiState production and collection are lifecycle-aware
👀? 👇
🎁
#JetpackCompose
is finally in alpha! 🎊
We prepared a lot of content for you:
📚 Documentation:
👾 9 Samples:
👩💻 6 Codelabs:
🏎 1 Pathway:
Give it a try and provide feedback 👩🔬
All ViewModel APIs in one place! 🥹
There are multiple ways to obtain a ViewModel and you should choose one depending on the libraries that you use. To help you figure it out, we just released a new cheat sheet! 👌
Hope you find it useful 🙌
🎉 Exciting News! 🚀 Thrilled to announce that I am now a Google Developer Expert on Android! 🤖📱
Grateful for this opportunity to keep contributing to the Android community in a more meaningful way 🙌🔥
#GDE
#AndroidDev
#AndroidDevSummit
2021 brought a lot of great content 💝 to the Android community!
Here’s a thread about new content related to Architecture and Jetpack! Let’s start with the data layer all the way up until the UI 🎈
🧵👇
Hilt is here to stay! 🎯
Hilt’s been promoted to STABLE in v2.35 and is ready for you all to use. If you’re not convinced of its value proposition yet, learn more about Hilt and why you should use it in Android apps here:
🛎️ The wait is over!
Dagger and Hilt KSP processors are now available in the latest release, v2.48!
They are released as alpha, so please, try them out and give us feedback. For more information and docs, check out the release notes:
We had to keep it secret 🤐 but it's available now 🤩
The new Now in Android app is our new hero sample! 🦸
🌟 Starring modularization, Material3, Compose, large screens, and more!
More features to come, but feel free to take a look at the code already:
It’s September 1st already! 😱
Some of you, my favourite Android devs, (hopefully) took some time off in July or August. Our team kept releasing Architecture content while you were away and in case you might’ve missed it...
Let’s do a recap! 👇
Coroutines is a vast topic to learn. You don't know what you don't know 🤷♂️
We just published an "Additional resources" page under the coroutines documentation to help you discover other coroutines topics to learn about 📚
Back with the Dagger codegen series 🔬
Cheatsheet about how Dagger subcomponents and component dependencies work under the hood.
Take a look 🤓 you'll fully understand why they work as they do!
Spoiler alert ⚠️: the generated code is quite different depending on what you use!
Ever wondered what Dagger does under the hood? 🤔
Every annotation has a _point_ 🔍! Check out this cheatsheet to understand how Dagger interprets them and the code it generates for you 👩🔧
We often get asked why we don't recommend exposing events originated from ViewModels with Channels or SharedFlow 🧐
In this post, we explain the reasons why that's not a good idea along with other related antipatterns 🌵 Hope this clarifies your doubts!
#Dagger
added support for
#Gradle
's incremental annotation processing in version 2.18! 🎉 You can improve your build time in
#Java
and
#Kotlin
by explicitly enabling the 'dagger.gradle.incremental' compiler arg 🆓🚀
Code for Android apps below 👇
The documentation for Dagger in Android multi-module projects has been updated 📚
Before, it said _what_ you have to do, not _how_ to do it 😕
Now, you can find best practices (with code) for subcomponents and component dependencies 🧑💻
This weekend looks perfect to learn more about
#Kotlin
#Coroutines
🔀!
I published a lot of content for all kind of levels during the last month. Let’s do a quick recap ⚡️!
Starting 🧵
🥳 It's finally here!!! 🎊
🧩 M O D U L A R I Z A T I O N on Android 🙌
The team just published 2 pages about the benefits of modularization 💃 and how to modularize an Android app following our Architecture best practices 🕺
👉
📚 Interviewing at Staff+ level 📚
In this blog post, I share my interview preparation while applying to different Android positions last year. I hope this content helps you and sheds some light on your journey if you’re going through a career change 🙌
The Dagger and Hilt team started 2021 on fire 🔥!
The new 2.31 Dagger/Hilt release from last week brought great features that makes Hilt even closer to Beta/Stable 🚀
And the best-feature-added award 🏆 goes to… Assisted injection! 🥇
Don’t miss what else it’s in there 🧵👇
🔴 We just updated the Handle Configuration Changes page with a more modern narrative, best practices, and gotchas.
More work on this area is coming! So please, stay tuned, take a look at the page, and give us feedback :) Thank you!
The AndroidX lifecycle v2.1.0 library just went stable! No excuses to start using `viewModelScope` now 🎉
For ✅ unit tests, override Dispatchers.Main with a TestCoroutineDispatcher using `setMain` from the kotlinx-coroutines-test library.
More info 👇
🎉 Hilt is already in _Beta_ 🎉
This means that no more API or breaking changes will be made before reaching stable. Now it’s a great time to see how Hilt fits into your app if you haven’t tried already.
More information about this in the release notes:
The new Settings Panels in Android Q make resolving network issues pretty easy without losing your context. Also very easy to implement!
Check out the code ⬇️
👇👇👇 so much THIS!!!!!!! 👇👇👇
You can safely collect flows from Compose using the new `collectAsStateWithLifecycle` API available in the new `lifecycle-runtime-compose` artifact.
Please try it out and give us feedback. Thanks 🙌
In addition to Lifecycle 2.5.0 going stable, Lifecycle 2.6.0-alpha01 is also out now with a new lifecycle-runtime-compose artifact that provides the Lifecycle aware collectAsStateWithLifecycle() method.
📢 I've just published for sale the cheat sheets I used to prepare for Mobile System Design interviews.
They can make a huge difference between just doing okay or nailing the interview. Find steps to follow, decision trees, and more! 📝💡
More info 👇
#GoogleIO
2021 schedule is out!
So looking forward to showing what
@ianhlake
and I need to say about "Using Jetpack libraries in Compose", and answering live questions in the "Jetpack AMA" with
@yigitboyar
as well.
See you soon 👋
🪨🪨 the collectAsStateWithLifecycle API just hit stable 🪨🪨 You can find it in lifecycle-runtime-compose:2.6.0 🥳
Make your flow collection in Compose lifecycle-aware to conserve system resources when possible.
📚 Learn more about the API 👇
As of today, LiveData keeps being the recommended solution for consuming streams of data from the UI layer in Android.
The new lifecycle APIs that were released yesterday allow flows to catch up with what LiveData offers. But those APIs still need to be proven valid!
(1/3)
#JetpackCompose
is 1.0! It's stable & ready for production.
📰 Blog
🗺️ Roadmap
🎓 Learn
📄 Docs
Compose makes 🤖 UI so much faster & easier. Can't wait to see what you build with it.
TL;DR; of my last Coroutines talk at
#AndroidSummit
If you need a cancelling behavior when collecting from hot Flow producers (i.e. you want them to be cancelled when the UI is not visible on the screen), then keep using LiveData or DIY, new APIs will come at some point! 🧵👇
Oh yeah!! Looking forward to this 🙌🥳
"Congratulations! Your session Collect Like a Pro: a deep dive on the Android lifecycle-aware coroutines APIs has been accepted for
#KotlinConf
2024!"
See you there 😍
Curious about Coroutines
#Channel
↔️ and
#Flow
➡️? Get ready for adding them to your app 🏁
Content about best practices 👌, testing ✅, and more 🥳 in the README and code of this repo:
After 2 years without attending an Android conference in person,
#dcbln22
was out of this world! ✨
Had so much fun with colleagues I hadn't seen yet and with the Android community that never ceases to amaze me 🫶😍 Looking forward to more of this 🥰
💡 You can use Compose in your RecyclerViews 💡
Jetpack Compose interops with the View system gracefully. To learn how to use Compose in RecyclerViews properly, check out the docs:
The Google's Dagger team is on fire 🔥!
This is the first noticeable big change to how we normally use Dagger on Android.
More changes are coming that are... 🤐 Incredible!
Navigating a Dagger project just got easier! 🎉
#AndroidStudio
4.1 Canary 7 introduces smart navigation tools to help you with your Dagger-related code!
See how
@manuelvicnt
uses it in an Android app →
If the
#JetpackCompose
alpha release was a success, our team didn’t want to fall behind for the Beta release! 🚀
📚 Published 12 new guides, and updated the other 6 with much more info!
👾 Updated our 9 samples to `beta01`
(1/2)
🔴📹 My "State holders and state production in the UI layer talk" is already out!!!
If you want to learn the different types of state holders you can find in the UI layer, when to use which, and how to produce screen UI state... this talk is for you! 👀
Lifecycle's SavedStateHandle has let you observe changes via LiveData since its inception. Today's Lifecycle 2.5.0-alpha04 now provides a StateFlow alternative!
In Android Studio, tapping on the color indicator next to a color definition pops up a color selection box 🤯🤯 it even contains a color picker!
Great tips by
@crafty
&
@chrisbanes
at
#DCBERLIN19
WHO is excited about
#AndroidDevSummit
2021???
✋✋✋✋✋✋✋✋✋✋✋✋✋✋✋✋✋
Prepare some food, get ready for the Keynote, and then, ask me and the team questions about Modern Android Development!
See you later 👋
#GoogleIO
is back on May 11-12! Save the date 💾
If you need your Android dose earlier than that, we just started a new MAD Skills series about
#AppArchitecture
🧩
The teaser and data layer episodes are already out! See what's coming next 📹
🚨🚨 API restriction update 🚨🚨
If you're handling TextField state in Compose, you MUST use Compose State either in the UI or in the ViewModel. Do NOT use StateFlow or other reactive streams.
This might change in the future, but meanwhile, use Compose State.
Reasons below 👇
Prevent synchronization issues in your app!
We have best practices for handling TextField state in
#JetpackCompose
. We’re also working on improving TextField capabilities!
Get the details in
@astamatok
's blog →
This can only mean one thing...
#AndroidDevSummit
is just around the corner!! 🥳
Looking forward to next week when we'll share a lot of cool stuff the team's been working on! Can't wait 😍
is NOT deprecated. At
#AndroidDeveloperSummit
, we communicated that we won't be adding new features (major improvements) to the library but we're committed to maintaining it until a suitable stable replacement is available.
Permissions in Compose just got easier! 🥳
Please take a look at the _experimental_ APIs and give us feedback. We have more APIs as WIP but this is definitely a good start.
You can see them in action in Jetsurvey (), and in the accompanist sample app 👋
Accompanist v0.12.0 for
#JetpackCompose
has been released!
⏳ New Placeholder library, initially by
@fornewid
📫 New Permissions library, thanks to
@manuelvicnt
🕺 Animated insets support is no longer experimental
The Jetpack Compose basics codelab has just been updated to the latest version: `dev06`.
If you haven't tried it yet, you should! Compose simplifies and accelerates UI development on Android 👩💻💕
_Disclaimer_: not recommended to use in production yet 🙃
The first part of the 💥 Crash course on the Android UI layer 💥 blog post series is out!
This part introduces the UI layer and covers the UI 🎨 and UI state 🧾 entities in depth. Full of examples and with advanced use cases 😌
Get ready to explore the UI-nknown 🔍👇
Staff Android Engineer,
@manuelvicnt
, aims to summarise the
#AndroidDeveloper
guidance on the UI Layer in this article series.
Find out all the entities involved, understand the role each part plays, and discover best practices!
Check out part 1 ✨
Architecture Blueprints 🏗️ is back! We want it to be our experiments playground _again_ 🧑🔬
We just migrated it to Compose because a lot of exciting stuff is coming,
#AndroidDev
!
Read more about how we did it here 👇👌
If you didn't have time to watch the
#GoogleIO
2021 Android sessions, don't worry! We've got you covered 😊
This episode of
#NowInAndroid
is a great summary of everything that happened at I/O related to Android, including things that you might've missed.
You can already use parts of Hilt in non-Android Gradle modules 🤖! The new version 2.29.1 supports it ✅
For more information, check out the release notes
Got a lot of questions about AssistedInject and Hilt working together. AssistedInject will be added to Dagger and Hilt in the future so expect a good support there.
Meanwhile, you can still use its generated code in Hilt. Here's an example of how you'd do it:
A new `androidx.hilt:hilt-navigation-fragment` artifact has been released to get your Hilt-provided ViewModels that are scoped to a navigation graph.
One function! `hiltNavGraphViewModels(graphId)`, that’s it :D
Read more about it in the docs:
🛟 The Saving UI state on Android Google I/O 2023 talk is already available! 🥳
You'll learn the best practices to save UI state properly in both the View system and Jetpack Compose 👌
Flight attendant: Is there a doctor onboard?
Dad: *nudging me* that should’ve been you
Me: Not now
Dad: Not asking for a Software Engineer to help, are they?
Me: dad, there's a real emergency happening
Dad: Go and see if that new Android declarative UI toolkit helps them too
I've been working on my personal website with two goals in mind: 1) improving the reading experience with better fonts, colors and code snippets, and 2) finding related content more easily with tags.
Hope you like it :) feedback is welcome!
Demystifying coroutines:
You can run computations in parallel with both async and launch! The difference is that launch is "fire and forget" 🚀 and async returns a value 🎁.
All network requests happen in parallel in the code below 👇
💡 Dependency Injection and Hilt STUDY JAM
📅 Thu, Aug 19th
🕙 7PM CET — 9AM PT
🎙️
@manuelvicnt
&
@DThompsonDev
Learn DI and Hilt from 0 to 🦸!
Code-along with me 🧑💻, we have plenty of time to cover the basics of DI and master Hilt!
RSVP and join 👇
Thrilled to see StateFlow and SharedFlow promoted to stable. We're already very close to have a full Flow-only story for UI -> ViewModel communication in Android 😃
📚 Learn how the lifecycle-aware `repeatOnLifecycle` coroutine API was designed and 🧐 why we removed other APIs from the library 🙅
🙌 Shout-out to
@adamwp
,
@wkalic
,
@ianhlake
, and
@yigitboyar
for giving feedback and discussing the shape of these APIs.
The new Compose alpha version is out! Let’s welcome alpha10 🙌
All Compose samples have been already updated. Go check them out for inspiration and as a way to learn new APIs and best practices!
The Fragmented podcast episode 🎙️ about Coroutines 🔀 is out! Talking about it with
@objcode
@kaushikgopal
&
@donnfelker
was an absolute pleasure.
@kaushikgopal
: _Ok, quick question: What's better? RxJava or Coroutines?_ 🔥
Coroutines! 🗣️
📯 Did you know that the Kotlin compiler transform suspend functions to a finite state machine?
📯 A suspended function can resume the execution at any point because everything it needs to know it's contained in a Continuation object.
Learn more about it 👇
Ever wondered how coroutines work under the hood?
Hang out with
@manuelvicnt
to learn more about it, understand how coroutines can suspend without blocking threads, and much more!
📺 Watch coroutines simplify asynchronous
#Android
operations →
Cancelling
#coroutines
when they're no longer needed can be a task easy to forget and adds a lot of boilerplate code 😫 Learn about viewModelScope to simplify all that! 🥳
#AndroidDev
#Kotlin
Good morning
#dcldn23
!! 👋
Everything ready for the first day of talks and networking! If you want to chat about life at
@Bumble_Tech
or any other Android topics, come and say hi 🫣👏🤗 we'll be at the Bumble inc. booth during the day.
Great show brought by the Android team 👏
It was awesome to hear they're working on
1) Compose's strong skipping mode (1:02:05),
2) a new Jetpack library for long-running user-initiated jobs (1:11:18), and
3) Screenshot testing coming to AGP (9:18)!
#AndroidDev
#WayToGo
! 🥳
We just added a basic app architecture 🧩 to the Compose JetNews app!
✨ Highlights:
- Using the Executor + callback pattern until coroutines are available
- Pattern to asynchronously load UI data using composable functions that return a value
PR:
Working on this presentation for Friday! What do you want to know about coroutines in Android? StateFlow and SharedFlow will be covered!
Spoiler alert: I'll be talking about new features coming in the pipeline 😬 don't miss it out!
Using async tasks and coroutines can get tricky, especially when dealing with edge cases like interop with Java.
@manuelvicnt
is here to show us how to manage them and talk about StateFlow and other developments.
#AndroidSummit
The guide to background processing has been revamped with the 2020 MAD recommendations. Coroutines and WorkManager are taking a major role 💪
What do you think about them?
Processing background data is an important part of creating a responsive Android app. Define and categorize your background task use cases, and learn about the APIs you should use to execute them in this handy guide.
📖 Read more →
A new way to search Android and AndroidX code 👩💻! 💯 recommend it!
It's never been easier to go through the source code of your favourite Jetpack library 🥳!
🧐
We’re inagurating a new YouTube series:
#AndroidCodeAlong
!
Do you want to code along with
@calren24
and me? We’ll be programming some coroutines code together next week 😍
And it’ll be live! So RSVP, and prepare your questions. See you next week 👋
🎉 Our first
#AndroidCodeAlong
event starts NEXT WEEK!
We're kicking off the series by working on
#Kotlin
coroutines with the Android team.
Tweet us your questions using
#AndroidCodeAlong
and RSVP →
Had so much fun refactoring the Android Developer Summit 2019 Android app to use
#Coroutines
and
#Flow
😍
For lessons learnt, code, and best practices... check out the link below 👇
Lessons learnt using Flow!
In this post, Android DevRel Engineer,
@manuelvicnt
provides valuable insight into using Flow in the
#AndroidDevSummit
app; which has just been open sourced. 🔓
Read here ↓
If you didn't have time to watch the
#GoogleIO
2021 Android sessions, don't worry! We've got you covered 😊
This episode of
#NowInAndroid
is a great summary of everything that happened at I/O related to Android, including things that you might've missed.
Super excited about this talk!
It's been more than a year since we started working on the narrative for these topics. Really happy to have all the docs published now and grateful for being able to talk about this at ADS 🙌
Tune in 👂!
🔴 Next Monday, October 24 ➡️ 10:50am PT
Get a deep dive into the UI layer and the UI state production pipeline at
#AndroidDevSummit
. Tune in on October 24 to join us. →
You'll learn: the differences between UI and business logic, ViewModel, plain state holder class, and more!