Reputation: 1475
Would you please advise what is wrong with the code: I got JVM error while building:
Kotlin version = 1.5.21
Compose version = 1.0.1
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call 'remember' into @androidx.compose.runtime.Composable public fun TelephoneEditText(
$composer
: androidx.compose.runtime.Composer?,$changed
: kotlin.Int): kotlin.Unit defined in com.example.scrapper.ui Cause: Not generated File is unknown The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.inline.InlineCodegen$Companion.getCompiledMethodNodeInner(InlineCodegen.kt:578) at org.jetbrains.kotlin.codegen.inline.InlineCodegen.throwCompilationException(InlineCodegen.kt:101) at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:141)
@Preview
@Composable
fun TextEditOnScreen() {
Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
TelephoneEditText()
}
}
@Composable
fun TelephoneEditText() {
val textValue = remember {
mutableStateOf("")
}
val primaryColor = colorResource(id = R.color.design_default_color_primary)
OutlinedTextField(
label = { Text(text = stringResource(id =
R.string.phoneNumber)) },
colors = TextFieldDefaults.outlinedTextFieldColors(
focusedBorderColor = primaryColor,
focusedLabelColor = primaryColor,
cursorColor = primaryColor
),
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
value = textValue.value,
onValueChange = {textValue.value = it},
)
}
RESOLVED
Replaced:
implementation 'androidx.ui:ui-foundation:0.1.0-dev14'
with
implementation "androidx.compose.foundation:foundation:$compose_version"
Upvotes: 0
Views: 2633
Reputation: 88407
Your compose code is totally fine.
The issue is probably somewhere in your dependencies or in gradle setup
Try creating a new compose project to see if it reproduces.
If it works fine, compare gradle setup to find out what's different
If it doesn't work, consider reporting it to compose issue tracker with AS logs and code of your sample project
Upvotes: 1