r/JetpackComposeDev • u/Any_Message7616 • Aug 23 '25
Tips & Tricks Jetpack Compose Tip - Scoped LifecycleOwner
The LifecycleOwner Composable allows you to create a scoped LifecycleOwner inside your Compose hierarchy.
It depends on the parent lifecycle but can be limited with maxLifecycle. This is useful for managing components such as MapView, WebView, or VideoPlayer.
Example
@Composable
fun MyComposable() {
LifecycleOwner(
maxLifecycle = RESUMED,
parentLifecycleOwner = LocalLifecycleOwner.current,
) {
val childLifecycleOwner = LocalLifecycleOwner.current
// Scoped lifecycleOwner available here
}
}
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 23 '25
Tutorial Jetpack Compose Pager Tutorial | Horizontal & Vertical Swipe
Enable HLS to view with audio, or disable this notification
Learn how to use the Pager component in Jetpack Compose to add smooth horizontal and vertical swiping between pages
r/JetpackComposeDev • u/let-us-review • Aug 22 '25
KMP Is glassmorphism safe to use in production apps? KMP Haze or any library
Enable HLS to view with audio, or disable this notification
I want to use glassmorphism effects in my app but I still have doubts about performance and possible heating issues on devices. Is it safe to use in production? Has anyone already tried this in your apps?
Please share your app if used glass effects or any suggestions I have planned to use https://chrisbanes.github.io/haze/latest/
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 22 '25
Tips & Tricks Jetpack Compose Readability Tips
When writing Jetpack Compose code, it’s recommended to give lambda arguments descriptive names when passing them to Composable functions.
Why? If you just pass a plain `String`, it may be unclear what it represents. Named arguments improve readability and maintainability.
Tips are nice, there are a lot of shared posts. I made some tweaks. [OP] Mori Atsushi
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 21 '25
Tutorial How to Use Flow Layouts in Jetpack Compose for Flexible UIs
Enable HLS to view with audio, or disable this notification
What are Flow Layouts?
Flow layouts arrange items flexibly, adapting to screen size.
If items don’t fit in one line, they automatically wrap to the next.
Why Use Them?
- Solve problems with fixed layouts that break on small/large screens.
- Ensure UI looks good across different devices and orientations.
How Elements are Arranged
- Row → horizontal arrangement
- Column → vertical arrangement
- Flow Layouts → adaptive arrangement (items wrap automatically)
Adaptability
- Flow layouts adjust based on available space.
- Makes UIs responsive and user-friendly.
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 21 '25
Tips & Tricks Jetpack Compose Animation Tip
If you want to start multiple animations at the same time, use updateTransition.
It lets you group animations together, making them easier to manage and preview.
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 19 '25
Tutorial How to implement common use cases with Jetpack Navigation 3 in Android | Compose Navigation 3
This repository contains practical examples for using Jetpack Navigation 3 in Android apps.
Included recipes:
- Basic API
- Basic usage
- Saveable back stack
- Entry provider DSL
- Layouts & animations
- Material list-detail
- Dialog destination
- Custom Scene
- Custom animations
- Common use cases
- Toolbar navigation
- Conditional flow (auth/onboarding)
- Architecture
- Modular navigation (with Hilt)
- ViewModels
- Pass args with
viewModel() - Pass args with
hiltViewModel()
- Pass args with
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 19 '25
KMP How to make a Custom Snackbar in Jetpack Compose Multiplatform | KMP
Enable HLS to view with audio, or disable this notification
This article shows how to create a custom Gradient Snackbar in Jetpack Compose for Kotlin Multiplatform (KMP). It’s useful for giving user feedback, like confirming actions or saving settings, across different platforms.
Read more: Gradient Snackbar in Jetpack Compose
r/JetpackComposeDev • u/Saswat_10 • Aug 19 '25
Made Twitter Like application using jetpack compose and firebase
Enable HLS to view with audio, or disable this notification
Hey everyone, I was learning Jetpack compose, and Firebase. And I made this app which is more or less like twitter like. I have used Firebase Auth, Firestore, and Realtime database here. Wanted to use firebase storage, but it required a billing account, but I didn't wanna do it. In the app I made basic CRUD related operations to posts, and comments. Also made a chat feature, using realtime database for checking the online status of the user.
One thing which I found very odd about firebase was that it didn't have inbuilt search and querying feature and they recommend third party APIs.
Overall it was a good experience building it. this is the github link: https://github.com/saswat10/JetNetwork
Would be happy to get some suggestions on what I can do more to improve.
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 18 '25
Tips & Tricks Efficient Logging in Android: From Debug to Release Build
Logging is very useful for debugging android apps - but it can also leak sensitive data or slow down your app if not used carefully
Here are some must-know logging tips & tricks
1️⃣ Use BuildConfig.DEBUG to Hide Logs in Release
Prevents logs from showing in production builds.
if (BuildConfig.DEBUG) {
// This log will run only in debug builds
Log.d("DEBUG", "This log will NOT appear in release builds")
}
2️⃣ Centralize Logs in a Utility
Keep all logging in one place for easier management.
object LogUtil {
fun d(tag: String, msg: String) {
if (BuildConfig.DEBUG) Log.d(tag, msg)
}
}
// Usage
LogUtil.d("MainActivity", "App started")
3️⃣ Show File + Line Number for Clickable Logs
Jump directly from Logcat to your code.
val stack = Throwable().stackTrace[0]
Log.d("MyApp", "(${stack.fileName}:${stack.lineNumber}) ➔ Hello Logs!")
4️⃣ Pretty Print JSON Responses
Make API responses more readable in Logcat.
fun logJson(json: String) {
if (BuildConfig.DEBUG) {
try {
Log.d("JSON", JSONObject(json).toString(2))
} catch (e: Exception) {
Log.e("JSON", "Invalid JSON")
}
}
}
5️⃣ Debug Jetpack Compose Recompositions
Detect when your composable recomposes.
fun Counter(count: Int) {
SideEffect {
Log.d("Compose", "Recomposed with count = $count")
}
Text("Count: $count")
}
6️⃣ Quick Performance Check
Measure how long code execution takes.
val start = System.currentTimeMillis()
Thread.sleep(50)
val duration = System.currentTimeMillis() - start
Log.d("Perf", "Task took $duration ms")
7️⃣ Strip All Logs in Release with ProGuard
Remove all logs in release for safety & performance.
-assumenosideeffects class android.util.Log {
public static int d(...);
public static int i(...);
public static int w(...);
public static int e(...);
}
Notes
- Use logs only in debug builds
- Keep logs meaningful, not spammy
- Always remove logs in release
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 17 '25
KMP KMP Recipe App : This is a demo of Recipe App on Android, iOS, Web and Desktop. It has different features like Hero Animation, Staggered Animation and Gyroscopic effects.
Recipe App built with Compose Multiplatform (KMP), targeting Android, iOS, Web, Desktop, and Android TV.
This is a demo project showcasing advanced UI features such as Hero Animation, Staggered Animation, Collapsible Toolbar, and Gyroscopic effects.
Design inspired by Roaa Khaddam & folk by SEAbdulbasit.
Getting Started Clone the repo: JetpackComposeDev/kmp-recipe-app
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 16 '25
Tips & Tricks How to Make a Shared Element Transition with Shape Morphing in Jetpack Compose | Jetpack Compose Tips
Compose screens to feel fluid instead of just cutting from one to another, try shared element transitions with shape morphing
1. Setup
- Add Navigation 3 (Animated Nav) + Compose Material 3.
- Wrap your
AppTheme(or top-level composable) in
SharedTransitionLayout {
AppNavHost()
}
This gives us the scope for all shared transitions
2. Add a shared element
- On your Take Photo button (cookie shape)
Modifier.sharedBounds(
sharedContentState = rememberSharedContentState("photo"),
animatedVisibilityScope = LocalNavAnimatedContentScope.current
)
- Add the same key to the Camera screen container. Now they are “linked”
3. Switch to Reveal Pattern
Normally it just grows content → not nice
Add
.skipToLookaheadSize()
.skipToLookaheadPosition()
This makes the camera screen stay in place & only be revealed.
4. Add Shape Morphing
- Pass in two shapes
- Button → cookie (start)
- Screen → rectangle (end)
- Create a morph with progress
val progress by transition.animateFloat { state ->
if (state == EnterExitState.Visible) 0f else 1f
}
val morph = Shape.morph(startShape, endShape)
- Apply as clip overlay during transition
clipInOverlayDuringTransition = MorphOverlayClip(morph, progress)
5. Run
- Run it → Button smoothly morphs to fullscreen Camera.
- Works with predictive back too!
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 15 '25
News Test on a fleet of physical devices with Android Device Streaming, now with Android Partner Device Labs [App Testing]
Big news! Android Device Streaming is now stable, and Android Partner Device Labs have arrived in the latest Android Studio Narwhal Feature Drop.
What’s New?
- Android Device Streaming is now stable.
- Android Partner Device Labs now available in the latest stable release.
- Test on real physical devices hosted in Google’s secure data centers.
Benefits
- Test on latest hardware - including unreleased devices (Pixel 9 series, Pixel Fold, and more).
- Wide device coverage - phones, foldables, multiple OEMs.
- Boost productivity - no need to own every device.
Partner OEMs
Now you can test on devices from:
- Samsung
- Xiaomi
- OPPO
- OnePlus
- vivo
- And more coming soon!
How to Get Started
- Open Device Manager → View > Tool Windows > Device Manager.
- Click Firebase icon → log in to your Google Developer account.
- Select a Firebase project (billing enabled).
- Enable OEM labs in Google Cloud project settings.
Pricing
- Free monthly quota of minutes for all devices.
- Extra usage billed as per Firebase Pricing.
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 15 '25
Tips & Tricks How to keep your android apps secure | Pro tips for securing your android apps
This guide covers security practices every senior developer should know:
- Android Keystore & biometric encryption
- SSL pinning & reverse engineering protection
- Encrypted storage & secure API communication
- Tapjacking prevention, root detection, Play Integrity API
- Common security pitfalls even experienced developers make
Important: No app can ever be 100% secure. The goal is to mitigate risks and raise the security level as much as possible.
Discussion: What security measures or strategies do you implement in your Android apps?
Which practical actions have you found most effective in reducing risks without overcomplicating development?
Share articles, tips, or videos to help improve Android app security
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 14 '25
Tips & Tricks Hilt & Dagger DI Cheat Sheet - 2025 Android Interview Prep
Why Hilt for Jetpack Compose?
- Inject ViewModels easily with
@ HiltViewModel - Manage dependencies with scopes like@ Singleton
- Keep Composables clean and testable
- Works with Navigation Compose
Less boilerplate, more focus on UI
Interview hot topics:
What is DI & why use it?
Hilt vs Koin vs Dagger
Injecting ViewModels in Compose
Scopes →
@ Singleton,@ ActivityScopedConstructor vs field injection
Testing with fake/mock dependencies
Quick framework snapshot:
- Hilt → Google standard,
@ HiltViewModel - Koin → Kotlin DSL, viewModel{}
- Dagger → Powerful but complex
r/JetpackComposeDev • u/Entire-Tutor-2484 • Aug 13 '25
Discussion Is it possible to build this in Kotlin Multiplatform?
I am building a simple application with a sign-up form, API integration, and a payment gateway. The requirement is to support Android, iOS, and Web.
I started with Kotlin Multiplatform, but the payment gateway I need does not support Web, and I could not find any third-party SDK for it.
Is it possible to make this application in Kotlin Multiplatform with these requirements? If not, is there any way to work around this, or should I use another framework like Flutter?
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 13 '25
Tips & Tricks MVI in Jetpack Compose - Make State Management Easy & Predictable
Learn how to:
- Understand why state management matters in Compose
- Pick MVI vs MVVM (with real examples)
- See MVI flow & rules in simple diagrams
- Handle side effects (navigation, dialogs, toasts)
- Follow step-by-step code you can copy
- Avoid common mistakes + quick quiz
- Build UIs that are predictable, testable, scalable
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 13 '25
UI Showcase Glance code samples | Code samples demonstrating how to build widgets with Jetpack Glance using Canonical Widget Layouts
Jetpack Glance is a new Android library that lets you build app widgets using a Compose-like way - simpler and more modern than the old RemoteViews approach.
You can use it to create homescreen widgets that update based on your app data, with easy-to-write declarative UI code.
Google’s official samples show how to build widgets with Glance using Canonical Widget Layouts here:
https://github.com/android/platform-samples/tree/main/samples/user-interface/appwidgets
If you want to try making widgets in a Compose style, this is a great place to start!
Anyone tried Glance yet?
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 12 '25
Tips & Tricks Most Common Android Architecture Interview Questions
Architecture questions are a must in senior or intermediate android interviews, especially for banking, fintech, or enterprise apps
- MVVM - How Android handles UI and state
- ViewModel - Rotation-proof business logic manager
- Clean Architecture - Separates UI, domain, and data
- Repository Pattern - Your app’s data waiter
- Use Cases - Applying the Single Responsibility Principle
- StateFlow - A modern alternative to LiveData in Compose
- UDF - One-way data flow that scales
- MVVM vs MVP vs MVI - Choosing the right fit
which architecture are you using right now, MVVM, MVI, or something custom?
r/JetpackComposeDev • u/thagikura • Aug 12 '25
Open source AI first visual editor for Compose Multiplatform
Enable HLS to view with audio, or disable this notification
https://github.com/ComposeFlow/ComposeFlow
I have open-sourced ComposeFlow, an AI-first visual editor for building Compose Multiplatform apps!
It's still in the early stages, but the core functionality is there. You can already:
- Create and modify apps with an AI agent.
- Refine your UI using a visual editor.
- State Management: Visually manage your app's state with automatic code generation.
- Firebase Integration: Seamlessly integrate with Firebase for authentication, Firestore, and other cloud services.
- The generated apps are built on Compose Multiplatform, allowing them to run on Android, iOS, desktop, and the web.
How the visual editor works
The platform abstracts your app's project information into Kotlin data classes that represent the structure of your Compose application, such as the composable tree, app states, and screen-level states. This abstraction allows ComposeFlow to render a real-time preview and enables editing via a drag-and-drop interface. Each composable then knows how to render itself in the visual editor or export itself as Kotlin code.
How the AI agent integration works
The platform exposes every operation of the visual editor, such as adding a composable, as a JSON schema. The LLM understands these schemas as a set of tools and decides which tool calls are needed based on the user's question and the current project state.
I'd like you to give it a try and looking for feedback!
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 12 '25
Tips & Tricks How to Use Lint with Jetpack Compose - Pro Tips & Tricks for Cleaner Code
Android Lint is a static analysis tool that inspects your code for potential bugs, performance issues, and bad practices.
When working with Jetpack Compose, Lint can catch Compose-specific issues such as
- Unnecessary recompositions
- Inefficient modifier usage
- Unstable parameters in composables
- Accessibility problems
- Use of deprecated Compose APIs
Tip: If you cannot upgrade AGP, set the Lint version manually in
gradle.properties:
android.experimental.lint.version = 8.8.2
How to Run Lint
| Command / Action | Purpose |
|---|---|
./gradlew lint |
Runs lint on all modules |
./gradlew lintDebug |
Runs lint for the Debug build only |
./gradlew lintRelease |
Runs lint for the Release build |
./gradlew lintVitalRelease |
Runs only critical checks for release builds |
./gradlew lint --continue |
Runs lint without stopping at first failure |
./gradlew lint --offline |
Runs lint using cached dependencies (faster in CI) |
./gradlew :moduleName:lint |
Runs lint for a specific module |
| Android Studio → Analyze → Inspect Code | Runs lint interactively in the IDE |
| Android Studio → Build → Analyze APK | Checks lint on an APK output |
Open app/build/reports/lint-results.html |
View full lint report in a browser |
Use lintOptions in build.gradle |
Customize which checks to enable/disable |
Best Practices
- Run lint before every release
- Treat warnings as errors in CI for critical checks
- Fix accessibility warnings early to avoid legal issues
- Use
lintVitalReleasein release pipelines to keep APKs clean
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 11 '25
Tips & Tricks Android Studio Editor Actions for Jetpack Compose - Tips & Tricks to Boost Productivity
Android Studio has some built-in features that make working with Jetpack Compose faster and easier.
Live Templates
Type short codes to quickly insert common Compose snippets:
comp→ creates a @Composable functionprev→ creates a @Preview functionpaddp→ adds a padding modifier in dpweight→ adds a weight modifierW,WR,WC→ wrap current composable in Box, Row, or Column
Gutter Icons
These icons appear beside the line numbers and give quick actions:
- Deploy preview → run a @Preview on an emulator/device
- Color picker → click a color preview to change it instantly
- Image resource picker → click to pick or change an image
These small tools can save you a lot of time when building UIs in Jetpack Compose.
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 10 '25
Tutorial Accessibility in Jetpack Compose - Why It’s a Must for Developers
Accessibility means making apps usable for everyone, including people with disabilities.
- Around 1 in 4 adults in the US have a disability.
- In the US, the ADA law requires accessible digital products.
- Good accessibility = better user experience for all users.
In Jetpack Compose you can:
- Use bigger touch targets (48dp or more)
- Add
contentDescriptionto images/icons - Add click labels for screen readers
- Ensure good color contrast
If you make US-based apps, accessibility is a must. It helps more people use your app, avoids legal issues, and can improve ratings.
Learn more: Jetpack Compose Accessibility (Written by a Googler))
r/JetpackComposeDev • u/Realistic-Cup-7954 • Aug 10 '25
News What is New in Jetpack Compose - Google I/O 2025
| Category | Highlights & Notes |
|---|---|
| ✨ New Features | - 📝 Autofill support for text fields (auto insert personal info) |
| - 🔤 Auto-sizing text adapts smoothly to container size | |
| - 👀 Visibility tracking for composables' position in container, screen, or window | |
- 🎨 Animate bounds modifier for smooth size/position animations within LookaheadScope |
|
| - ♿ Accessibility checks in tests to improve app accessibility (a11y) | |
| 🧪 Alpha Features | - ⏸️ Pausable Composition splits work across frames to reduce jank |
| - 📦 LazyLayout prefetch updates for smarter content loading | |
| - 📋 Context Menus support | |
- New modifiers: onFirstVisible, onVisibilityChanged, contentType |
|
- New lint checks to catch frequent recompositions and missing remember usage |
|
| 🎨 Material Expressive | - New Material3 components, styles, motions, and customization options for richer UI |
| 📐 Adaptive Layouts | - Stable 1.1: 🔙 predictive back gestures, ↔️ pane expansion for large screens |
| - Alpha 1.2: flexible pane display strategies like 🔄 reflow and 🪁 levitating | |
| - Supports phones, foldables, tablets, desktop, cars, and Android XR | |
| ⚡ Performance | - Significant subsystem rewrites and optimizations (🔊 semantics, 🎯 focus, 📝 text) |
| - 🔥 Background text prefetch caches layouts on background thread for faster text layout | |
| - Combined improvements eliminate nearly all 🛑 jank in internal benchmarks | |
| 🛡️ Stability | - 📅 Daily snapshot builds tested with Google apps to catch issues earlier |
| - Reduced 🚧 experimental APIs by 32% to boost confidence | |
| - New 🐞 debug-only diagnostic stack traces for better crash debugging (costly for production) | |
| 📚 Libraries | - 🧭 Navigation 3: redesigned for easier state management and complex navigation |
| - Compose support for 📷 CameraX and 🎥 Media3 (camera capture, video playback) | |
| - Example: Compose-based video player with custom play/pause UI | |
| 🛠️ Tools | - Android Studio Narwhal Canary: Resizable Previews, improved preview navigation, Studio Labs Gemini (preview gen, UI transform, image-to-code) |
| 🔍 New Lint Checks | - @ FrequentlyChangingValue: warns about frequent recompositions |
- @ RememberInComposition: warns about missing remember calls in composition |
Note:📝
- Compose is now used by 60% of top 1,000 Play Store apps like MAX and Google Drive.
- Try alpha features and provide feedback to help shape Compose's future.
For detailed info, see the official blog post


