https://kotlinlang.org logo
#compose
Title
# compose
r

Robert Menke

10/05/2020, 3:10 PM
I’ve been stuck on this error for like 8 hours. I have a simple component
Copy code
@Composable
fun EmailTextField() {
    val viewModel = viewModel<AuthenticationViewModel>()
    val text: String by viewModel.email.observeAsState("")
    TextField(
        value = text,
        onValueChange = viewModel::setEmail,
        label = { Text(text = "What's your email address?") },
        placeholder = { Text(text = "<mailto:jane.doe@gmail.com|jane.doe@gmail.com>") },
        keyboardType = KeyboardType.Email,
        modifier = frameFillWidth(60.dp)
    )
}
The context it’s called in is this:
Copy code
@Composable
fun SignInEmailView() {
    SingleInputLayout(
        onBackClicked = {},
        onNextClicked = {},
        children = {
            EmailTextField()
        }
    )
}
and I get the error:
Copy code
e: java.lang.IllegalArgumentException: Unbound type parameters are forbidden: [Unbound private symbol org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl@124a0920, Unbound private symbol org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl@6e295b2d]
I’ve been able to isolate this error to the
EmailTextField
view and when I comment it out the error goes away. I’ve tried reproducing in a sample project but have been unable to do so. Does anything in the example I’ve provided seem off? compose: 1.0.0-alpha04 kotlin: 1.4.10
a

allan.conda

10/05/2020, 3:13 PM
try
Copy code
onValueChange = { viewModel.setEmail(it) },
Or it’s probably the viewmodel declaration, you could try providing it outside a composable
r

Robert Menke

10/05/2020, 3:22 PM
Hmm I’ll try passing the view model in directly
Nope, still no luck there
a

allan.conda

10/05/2020, 3:46 PM
Are you on a pure compose project? Could be databinding
or kotlin synthetics
r

Robert Menke

10/05/2020, 4:49 PM
Ya this is a brand new project created with compose. I’m not using synthetics. Is this a known issue with data binding @allan.conda?
a

allan.conda

10/05/2020, 4:51 PM
Yes, I encountered the same issue
r

Robert Menke

10/05/2020, 5:12 PM
How did you solve it?
a

allan.conda

10/05/2020, 8:15 PM
If it’s a brand new project, you shoudn’t need data binding. I think updating agp and AS to at least alpha10 fixes the issue?
r

Robert Menke

10/05/2020, 8:48 PM
Oh got it I thought you were referring to LiveData. What is AS?
d

Denis Sakhapov

10/06/2020, 2:18 AM
I believe AS here means Android Studio
👆 1