mikepenz / AboutLibraries

AboutLibraries automatically collects all dependencies and licenses of any gradle project (Kotlin MultiPlatform), and provides easy to integrate UI components for Android and Compose-jb environments
http://mikepenz.github.io/AboutLibraries/
Apache License 2.0
3.67k stars 423 forks source link

java.lang.NoSuchMethodError: No static method FlowRow with compose 1.8.0 #1033

Open kodebach opened 5 days ago

kodebach commented 5 days ago

About this issue

The library is not compatible with using the newest compose 1.8.0 version. Trying to use LibrariesContainer results in:

java.lang.NoSuchMethodError: No static method FlowRow(Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/Arrangement$Horizontal;Landroidx/compose/foundation/layout/Arrangement$Vertical;IILandroidx/compose/foundation/layout/FlowRowOverflow;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;II)V in class Landroidx/compose/foundation/layout/FlowLayoutKt; or its super classes (declaration of 'androidx.compose.foundation.layout.FlowLayoutKt' appears in  /base.apk)
  at com.mikepenz.aboutlibraries.ui.compose.SharedLibrariesKt.Library(SharedLibraries.kt:294)
  at com.mikepenz.aboutlibraries.ui.compose.SharedLibrariesKt$Libraries_ajgufuY$lambda$11$lambda$10$$inlined$libraryItems$1.invoke(LazyDsl.kt:434)
  at com.mikepenz.aboutlibraries.ui.compose.SharedLibrariesKt$Libraries_ajgufuY$lambda$11$lambda$10$$inlined$libraryItems$1.invoke(LazyDsl.kt:152)
  at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:142)
  at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51)
...

Details

It's caused by this CL https://android-review.googlesource.com/c/platform/frameworks/support/+/3156116, which breaks binary compatibility. Since FlowRow is marked with @ExperimentalLayoutApi that is not a bug, so I don't think reporting this issue the Compose issue tracker will help.

AFAICT the only workaround from our side (other than not using compose 1.8.0 yet) is to copy essentially fork the library by copying the sources from SharedLibraries.kt. The sources don't need any changes, since API change to FlowRow is source-compatible.

Versions

kodebach commented 5 days ago

Another workaround is to call LibrariesContainer with showLicenseBadges = false (to avoid the FlowRow for the badges) and some lambda for onLibraryClick (to avoid the FlowRow in the custom Dialog). If the non-Android-specific LibrariesContainer overload that takes a Libs is used, you still need to use onLibraryClick because with both onLibraryClick = null and licenseDialogBody = null clicking a library becomes a no-op, if the library has an HTML license.

mikepenz commented 2 days ago

The latest beta 11.3.0-b01 does use compose multiplatform 1.7.0 which might already solve the binary conflict

If not, the library itself is not updated for compose 1.8.0 and will likely only do so only once compose 1.8.0 reaches more stable releases (or is available in compose mulitplatform)