Skip to main content
Filter by
Sorted by
Tagged with
4 votes
1 answer
71 views

I’m using Android Studio with Jetpack Compose, and I often use the “Find in Files” feature (Cmd + Shift + F / Ctrl + Shift + F / clicking in a function/class to see the usages) to search for code ...
Pierre Vieira's user avatar
1 vote
1 answer
246 views

I'm learning Jetpack Compose and working with Android Studio's preview feature. When I hover over a Text composable that has padding applied, the layout bounds (blue outline) only show the text ...
Shivam's user avatar
  • 13
5 votes
1 answer
312 views

Recently, I stumbled upon what seems to be a strange glitch in Android Studio. No matter what kind of Kotlin file I create (object, interface, class—anything), the IDE always opens it as if it ...
aga's user avatar
  • 29.6k
0 votes
0 answers
24 views

I am using a Google font. I downloaded the ttf files and properly set the FontFamily and Typography. Preview are correctly showing the fonts, but they are distorted. They seem pixelated. My goal is to ...
kristyna's user avatar
  • 2,267
7 votes
1 answer
686 views

I have followed https://developer.android.com/studio/preview/compose-screenshot-testing and can't seem to get any version outside of 0.0.1-alpha01 to work. With alpha02 and higher I am seeing: An ...
isuPatches's user avatar
  • 7,754
5 votes
0 answers
718 views

I just started exploring android compose preview screenshot testing. In my first attempting running the tests via ./gradlew updateDebugScreenshotTest I got the following error Cannot update reference ...
Mehdi Satei's user avatar
  • 1,640
0 votes
1 answer
525 views

I have the issue that whenever I have a multi-module project, all Jetpack Compose UI previews except for the ones in the app module display an additional TopAppBar with the text androidx.compose.ui....
Blaupunkt's user avatar
  • 129
0 votes
1 answer
521 views

Using WindowsInsets(android tutorial) in app with jetpack compose, doesn't show on @Preview. Here my Modifier.windowInsetsPadding(WindowInsets.safeContent) does not apply as Preview. If I replace ...
MakiX's user avatar
  • 452
2 votes
0 answers
398 views

I'm currently improving previews in my android app (which is using mostly jetpack compose). When i only use @Preview(showBackground=true) the background color of the preview defaults to almost-black, ...
m.reiter's user avatar
  • 2,685
1 vote
0 answers
143 views

I'm facing an issue when trying to use the Jetpack Compose @Preview annotation in my Android project. Whenever I try to preview a Composable function, I encounter a java.lang.StackOverflowError. Here ...
MohammadBaqer's user avatar
4 votes
1 answer
2k views

I'm just learnig Compose. I want to make Compose Preview background color setting the same as run app mode. What is wrong with my code? Preview code @Preview(showBackground = true) @Composable fun ...
Junbeom Jeon's user avatar
1 vote
1 answer
468 views

I have a fragment which has an injected variable timeZoneId, which now I have to pass to a composable. @Inject lateinit var timeZoneId: ZoneId In Composable I have a preview, how can I add this to ...
BRDroid's user avatar
  • 4,458
7 votes
2 answers
3k views

I started migrate our code to Compose and have problem with @Preview. For example, when I use modifier.fillMaxWidth() without default param "fraction = 1f" I have render problem java.lang....
Ihor's user avatar
  • 71
1 vote
1 answer
1k views

My app has a module that uses Jetpack Compose and another non-Android (plain Java Library) module with some Java classes. I ran into an issue where Jetpack Compose preview is failing with a render ...
EvilDuck's user avatar
  • 4,446
0 votes
2 answers
319 views

During android jetpack compose development I use this code to see some preview result: GlideImage( imageModel = { imageUrl }, modifier = Modifier.aspectRatio(0.8f), previewPlaceholder = R....
A. Patrik's user avatar
  • 1,732
0 votes
1 answer
94 views

Consider a Composable screen with the following parameters: @Composable fun PurchaseSubscriptionScreenContent( availableSubscriptions: List<ProductDetails>, selectedSubscription: ...
James Olrog's user avatar
9 votes
1 answer
4k views

Sometimes when I use a string resource in my composable, the preview will show the wrong string. It always works fine for literal strings, only string resources are wrong. The bug isn't consistent. ...
Eva's user avatar
  • 4,960
11 votes
3 answers
5k views

I am using Jetpack Compose and noticed that the preview is not shown. I read articles like this, but it seems my problem has a different root cause. Even I added defaults to all parameters in the ...
MeLean's user avatar
  • 3,491
4 votes
1 answer
968 views

Like below are two functions @Composable private fun WaterCounter(modifier: Modifier = Modifier) { val count = 0 Text( text = "You've had $count glasses of water", ...
Tehleel Mir's user avatar
1 vote
1 answer
1k views

What I have : I have a compose class that has a button I want to see the preview in the design view Issue I am facing : For the click How to pass as an object on the line I have marked in code Is ...
Devrath's user avatar
  • 42.9k
10 votes
1 answer
4k views

I use Coil to load .svg resources from the web, for example: @Composable fun Widget(modifier: Modifier = Modifier) { AsyncImage( modifier = Modifier.fillMaxSize(), model = ...
hescul's user avatar
  • 131
19 votes
5 answers
10k views

I want to use Jetpack Compose in my App. I am already using Koin for DI. Because I have a lot of convenience methods in my BaseFragment I want to inherit from it and build the corresponding view with ...
Lukas Schüler's user avatar
8 votes
5 answers
13k views

Android Studio Chipmunk 2021.2.1; Compose Version = '1.1.1'; Gradle Version 7.4.2; Kotlin 1.6.10; Up to one point, everything was working. Then this error appeared and the preview stopped working ...
Anton Kotov's user avatar
4 votes
1 answer
1k views

Simple scenario, I have a vector drawable in my res folder, which I wish to access in a Compose Preview. Actually, it is a Canvas that draws the vector, and so, I use a painter (a vector painter, to ...
Richard Onslow Roper's user avatar
39 votes
2 answers
13k views

I've recently got an error preventing any Jetpack Compose previews from being displayed as follows: Failed to instantiate one or more classes The following classes could not be instantiated: -...
olistocks98's user avatar
2 votes
1 answer
4k views

I have a multi module app where I recently began implementing Jetpack Compose. I defined some composables to be shared by different modules. I put those in another library module and imported in ...
Serge's user avatar
  • 517
7 votes
3 answers
8k views

I am bootstrapping a new app with Jetpack Compose and Material 3. I've created a bunch of new apps lately with this configuration, so this problem has me stuck: I cannot get the IDE's compose previews ...
Oliver Spryn's user avatar
  • 17.4k
1 vote
1 answer
1k views

Problem description I'm trying to see a preview of my AlertDialog in compose but I'm not getting it, the preview doesn't render it even though it doesn't show any error. I'm sure the problem is only ...
Pierre Vieira's user avatar
1 vote
1 answer
247 views

I built an app from the Android Studio template using the new Compose feature (official docs). The Preview looks like the following: However, when I run the application, it looks like this (text is ...
raddevus's user avatar
  • 9,296
2 votes
0 answers
99 views

I have a MainScreen composable being injected with a viewmModel using hilt. @Composable fun MainScreen( viewModel: MainScreenViewModel = hiltViewModel() ) {} The problem is that I cannot use this ...
barryalan2633's user avatar
3 votes
3 answers
5k views

What are widthDp and heightDp as a @Preview parameter? 【My environment】 Android Studio Arctic Fox | 2020.3.1 Patch3 build on October 1, 2021 Gradle: 7.0.2 AGP: 7.0.3 androidx.compose.ui:ui-tooling-...
user13986631's user avatar
0 votes
2 answers
6k views

I'm trying to use the Modifier.blur feature of Jetpack Compose for a project for work and it seems to not do anything in the preview. I'm using it like this: Column(modifier = Modifier .blur(30.dp)...
daniel-eh's user avatar
  • 414
13 votes
2 answers
4k views

So it seems like the recommended thing in Jetpack Compose is to hoist state out of your composables, to make them stateless, reusable, and testable, and allow using them in previews easily. So instead ...
Matteo Melis's user avatar
7 votes
1 answer
2k views

Rendering the Jetpack Compose Preview fails when we have some code calling LocalDate.now() from it. We have tried setting a locale on the preview but that does not help, and we have not found any ...
Morten Holmgaard's user avatar
21 votes
6 answers
4k views

With the first patch for AS Arctic Fox Jetpack Compose previews stopped working. I'm getting this error for all previews - even older ones, which worked fine a while back: android.content.res....
Primož Ivančič's user avatar
14 votes
3 answers
3k views

I am developing an app using Jetpack compose and have a problem with fonts import during Jetpack preview. Preview is empty and show an error (Render problem): Font resource ID #0x... cannot be ...
Peter Staranchuk's user avatar
3 votes
2 answers
2k views

I have the following composable function that creates a TopAppBar. The preview shows the bar just fine, but can I get the menu to expand in the preview as well? @Composable @Preview fun AppBarTop(...
Khantahr's user avatar
  • 8,583
19 votes
1 answer
3k views

Taking first steps in Jetpack Compose, which is quite amazing except one annoying issue. I have a constant set of previews: Normal, Dark and RTL: @Preview( name = "Normal", group = &...
Shlomi Katriel's user avatar
5 votes
1 answer
3k views

I use Compose with AS Arctic Fox v2020.3.1. When I update the code, the preview does not render in real-time. AS show the message "The preview is out of date" and I must click "Build &...
PhongBM's user avatar
  • 1,008
13 votes
5 answers
11k views

I am unable to preview anything in Studio, extending to something as simple as a Text. I get a "Render Error", revealing this stack trace. java.lang.NoSuchMethodException: com.<...
Richard Onslow Roper's user avatar
28 votes
4 answers
15k views

I'm using Android Studio Bumblebee 2021.1.1 Canary 3 + Compose 1.0-rc02, and there seems to be no easy way to force landscape mode for a preview, which includes using resources (in particular ...
machfour's user avatar
  • 2,769
1 vote
1 answer
6k views

Let's consider the following @Composable functions: @Composable fun WelcomeScreen() { ... ButtonTheme { Button(...) {...} } } @Composable @Preview fun MockWelcome() { AppTheme ...
GuilhE's user avatar
  • 11.9k
68 votes
8 answers
31k views

I followed the official guide to create viewModel instance and it works perfectly. However, when there is any viewModel in the @composable, Android Studio isn't able to render the preview and with the ...
musso's user avatar
  • 751