Monicah Odipo
Monicah Odipo

Reputation: 21

Overload resolution ambiguity. All these functions match AndroidStudio

What could be the problem here: enter image description here

I keep getting an error: Overload resolution ambiguity. All these functions match. public fun Text(text: String, modifier: Modifier = ..., color: Color = ..., fontSize: TextUnit = ..., fontStyle: FontStyle? = ..., fontWeight: FontWeight? = ..., fontFamily: FontFamily? = ..., letterSpacing: TextUnit = ..., textDecoration: TextDecoration? = ..., textAlign: TextAlign? = ..., lineHeight: TextUnit = ..., overflow: TextOverflow = ..., softWrap: Boolean = ..., maxLines: Int = ..., minLines: Int = ..., onTextLayout: ((TextLayoutResult) → Unit)? = ..., style: TextStyle = ...): Unit defined in androidx.compose.material3 public fun Text(text: String, modifier: Modifier = ..., color: Color = ..., fontSize: TextUnit = ..., fontStyle: FontStyle? = ..., fontWeight: FontWeight? = ..., fontFamily: FontFamily? = ..., letterSpacing: TextUnit = ..., textDecoration: TextDecoration? = ..., textAlign: TextAlign? = ..., lineHeight: TextUnit = ..., overflow: TextOverflow = ..., softWrap: Boolean = ..., maxLines: Int = ..., minLines: Int = ..., onTextLayout: (TextLayoutResult) → Unit = ..., style: TextStyle = ...): Unit defined in androidx.compose.material3

Upvotes: 1

Views: 3947

Answers (3)

Andre Jones
Andre Jones

Reputation: 1

I had a similar issue. Check your gradle modules, you probably have 2 material dependencies.

Upvotes: 0

Shobhit singh
Shobhit singh

Reputation: 1

I got the same error when using Text composable and as already given answer here.

I tried and found in gradle(Module) file that there are 2 compose material 3 dependencies are there and one is outdated as well.

So by removing one and and updating the remaining one resolve my issue as well.

Upvotes: 0

Divyesh Kuchhadia
Divyesh Kuchhadia

Reputation: 51

This is the Error in dependencies where you should only have 1 implementation for material

I also got this error due to 2 times implementing material3 and with its version. I removed 1 and it resolved my error

Upvotes: 4

Related Questions