Gradle cannot find Android Compose Compiler

Had the same issue and resolved after updating the gradle version to classpath “com.android.tools.build:gradle:4.2.0-alpha14” and instead of declaring compiler version kotlinCompilerExtensionVersion in the composeoptions, decalred as a dependency implementation “androidx.ui:ui-tooling:$compose_version” implementation “androidx.compose.runtime:runtime:$compose_version” implementation “androidx.compose.compiler:compiler:$compose_version”

How to get activity in compose

While the previous answer (which is ContextWrapper-aware) is indeed the correct one, I’d like to provide a more idiomatic implementation to copy-paste. fun Context.getActivity(): AppCompatActivity? = when (this) { is AppCompatActivity -> this is ContextWrapper -> baseContext.getActivity() else -> null } As ContextWrappers can’t possibly wrap each other significant number of times, recursion is fine … Read more

How do I trace and resolve Android App’s BLASTBufferQueue Faking releaseBufferCallback?

Here are some of the findings I got related to this issue. 1) What is BlastBufferQueue? I believe this must be happening in Android S and above and that too after december update 2022. BlastBufferQueue is kind of message queue, where the geometry of the app layout window changes ,it will be submitted to Android … Read more

Software keyboard overlaps content of jetpack compose view

You can use the standard android procedure, but I don’t know if a Compose specific way exists. If you set the SoftInputMode to SOFT_INPUT_ADJUST_RESIZE, the Layout will resize on keyboard change. class YourActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); setContent { /* Composable Content */ } } } otherwise, you could use … Read more

Scoping States in Jetpack Compose

This is precisely what navigation graph scoped view models are used for. This involves two steps: Finding the NavBackStackEntry associated with the graph you want to scope the ViewModel to Pass that to viewModel(). For part 1), you have two options. If you know the route of the navigation graph (which, in general, you should), … Read more

Ripple with rounded corners Jetpack Compose

Starting with M2 1.0.0-beta08 you can solve this issue using the onClick lambda parameter in the Card instead of the clickable modifier: Card( shape = RoundedCornerShape(30.dp), modifier = Modifier .fillMaxWidth() .padding(10.dp), onClick = { show = !show } ){ //card content } If you need the clickable or the combinedClickable modifier you have to use … Read more

How request permissions with Jetpack Compose?

as compose_version = ‘1.0.0-beta04’ and implementation ‘androidx.activity:activity-compose:1.3.0-alpha06’ you can do request permission as simple as this: @Composable fun ExampleScreen() { val launcher = rememberLauncherForActivityResult( ActivityResultContracts.RequestPermission() ) { isGranted: Boolean -> if (isGranted) { // Permission Accepted: Do something Log.d(“ExampleScreen”,”PERMISSION GRANTED”) } else { // Permission Denied: Do something Log.d(“ExampleScreen”,”PERMISSION DENIED”) } } val context = … Read more

remove default padding on jetpack compose textfield

You can use BasicTextField, it’s a plain text field without any decorations. Note that it doesn’t have placeholder/hint too, you have to implement those by yourself if you need. BasicTextField(value = “”, onValueChange = {}, Modifier.fillMaxWidth()) Since 1.2.0-alpha04 it’s much easier to make your BasicTextField look like TextField or OutlinedTextField. You can copy source code … Read more