Fixed
Status Update
Comments
rm...@google.com <rm...@google.com> #2
Able to repro on API 34, Compose ToT. I shortened the repro,
Sean, could you take a peek at this? It seems like there may be a disconnect between the font changing and then not picking up the correct weight. That or something is off with the way the font is created here, but I'm not certain.
xa...@google.com <xa...@google.com> #3
Forgot one part of the repro, you will need the
ch...@google.com <ch...@google.com>
qu...@google.com <qu...@google.com> #4
Clearly caching bug, minimal repro:
qu...@google.com <qu...@google.com> #5
private val fontWeights = listOf(100, 200, 300, 400)
private val fonts = listOf(
"Azeret" to R.font.azeret_mono,
"Roboto Mono" to R.font.roboto_mono,
)
@OptIn(ExperimentalTextApi::class)
private val fontFamilies = fonts.map { (_, resId) ->
FontFamily(
fontWeights.map { weight ->
Font(
resId = resId,
weight = FontWeight(weight),
variationSettings = FontVariation.Settings(FontVariation.weight(weight))
)
}
)
}
@Composable
fun Demo() {
Column {
FullListRepro()
// FullListOK()
}
}
@Composable
fun FullListRepro() {
Column {
fontWeights.forEach { weight ->
fonts.forEachIndexed { i, (familyName, _) ->
val fontFamily = fontFamilies[i]
val style = TextStyle(
fontFamily = fontFamily,
fontWeight = FontWeight(weight),
fontSize = 40.sp
)
BasicText("$weight $familyName", style=style)
}
}
}
}
@Composable
fun FullListOK() {
Column {
fonts.forEachIndexed { i, (familyName, _) ->
fontWeights.forEach { weight ->
val fontFamily = fontFamilies[i]
val style = TextStyle(
fontFamily = fontFamily,
fontWeight = FontWeight(weight),
fontSize = 40.sp
)
BasicText("$weight $familyName", style=style)
}
}
}
}
OK composable is fine, but if you switch the order you see the incorrect behavior coming from resource font loading.
Description
AI-182.5107.16.33.5199772, JRE 1.8.0_152-release-1248-b01x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920x1080
Android Gradle Plugin: 3.1.4
Gradle: 4.4
NDK: from local.properties: (not specified); latest from SDK: (not found);
LLDB: pinned revision 3.1 not found; latest from SDK: (package not found);
CMake: from local.properties: (not specified); latest from SDK: (not found); from PATH: (not found);
Source: user_sentiment_feedback
IMPORTANT: Please read
Hi, I got this error
Unsupported method: AndroidProject.getVariantNames().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.