Compose BOM 2024.02.00 breaks dynamic theme on physical devices

24 views Asked by At

Updating the Compose BOM from 2024.02.01 in my project breaks dynamic theming. I reproduced this using the default sample project that is created by default, and modifying it like this:

MainActivity.kt

package com.example.myapplication

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.eten.myapplication.ui.theme.MyApplicationTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            MyApplicationTheme {
                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
                    // Display box with primary color
                    Box(
                        modifier = Modifier
                            .size(100.dp)
                            .background(MaterialTheme.colorScheme.primary)
                            .padding(innerPadding)
                    )
                }
            }
        }
    }
}

ui.theme.Theme.kt is unmodified

When changing composeBom in libs.versions.toml from 2024.01.00 to 2024.02.00, the dynamic theme all of a sudden disappears, and changes into the default Google theme.

junitVersion = "1.1.5"
espressoCore = "3.5.1"
lifecycleRuntimeKtx = "2.7.0"
activityCompose = "1.8.2"
composeBom = "2024.02.00"

[libraries]
# ... libraries
Compose BOM Version Result
2024.01.00 enter image description here
2024.02.00 enter image description here
0

There are 0 answers