Fixed
Status Update
Comments
ha...@google.com <ha...@google.com>
pa...@google.com <pa...@google.com>
an...@google.com <an...@google.com> #2
There's a TODO in the code tracking the root cause of this problem, and I've added this bug number to it.
This works correctly for the following string "Android"
, because the containing function is @Composable
:
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
IguanaEmptyActivityTheme {
Greeting("Android")
}
}
This does not work correctly for this "Android"
, because onCreate
is not @Composable
and the extract string action isn't aware of @Composable
lambdas yet:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
EmptyActivityTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
Greeting("Android")
}
}
}
}
an...@google.com <an...@google.com>
kd...@google.com <kd...@google.com>
kd...@google.com <kd...@google.com>
an...@google.com <an...@google.com> #3
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Iguana | 2023.2.1 Canary 7
- Android Gradle Plugin 8.3.0-alpha07
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Description
When I try to extract an hard coded string using the context menu(orange bulb), the code generated is
getString()
, notstringResource()
.It worked fine in the Android Studio Dolphin version, it was
stringResource()
.