I'm getting bizarre runtime errors when running on...
# compose
c
I'm getting bizarre runtime errors when running on API 22, in an app targeting 21. Extension functions don't seem to be resolvable? (Tried on Java 1.8, 11 and 17, same errors) 🧵
The code being referenced is coming from an AAR that targets API 34, min 21. Compiled targetting java 17.
Copy code
java.lang.NoSuchMethodError: No static method weight$default(Landroidx/compose/foundation/layout/RowScope;Landroidx/compose/ui/Modifier;FZILjava/lang/Object;)Landroidx/compose/ui/Modifier; in class Landroidx/compose/foundation/layout/RowScope; or its super classes (declaration of 'androidx.compose.foundation.layout.RowScope' appears in /data/app/com.example.redacted-1/base.apk)
The only other interesting thing which I haven't ruled out yet is, I'm using K2, I'm going to try and not do that and see if the problem persists.
Even when not using the K2 compiler, I still have this issue ✔️ confirmed
Copy code
Row {
  ...
  Spacer(modifier = Modifier.weight(1f))
  ...
}
Is the offending code in the artifact, but if use the exact same expression in the application, it's fine with that. It's only code from the artifact. Is there special considerations when creating a JC library I'm unaware of?
doing a binary search for the API level that it finally stops working at. Currently runs as expected on 24 and up. It doesn't seem to work on 23 and below. (Only tested 23, 22 and 21, 21 being the lowest supported version for JC)
v
what are you referring to with JC?
are you running a debug or release build?
my team is running compose on api 22 and we haven't seen this issue, we're using kotlin 1.9.10 currently
c
debug, just figured it out, it's because of the call to
Modifier.weight(1f)
, without setting the
fill
parameter to a value, it looks like it's trying to resolve a method with a single parameter
this is with 1.9.0 and with an imported artifact, rather than a gradle module dependency
v
fill has a default value so it should definitely work
c
I'd agree with that statement, I'll try and make a minimal reproduction project
v
Is the artifact built with a matching compose version? we've had some binary incompatibility issues before I think
c
yeah using the 2023.08.00 bom
compose compiler 1.5.0
v
hard to say what the issue is here 🤔
we currently use compiler 1.5.3 and target jvm 11
c
it could be an emulator issue, on a real device running 5.1.1 it works :X
I'll still try and put together a small reproduction project
I managed to make a small repro project for the API21-23 issue with default method arguments being an issue in published libraries that use JC: https://github.com/ChrisAJS/JCApi21IssueRepro