Skip to content

Library not compatible with Compose 1.7.1+ #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JakeSteam opened this issue Dec 23, 2024 · 1 comment
Open

Library not compatible with Compose 1.7.1+ #186

JakeSteam opened this issue Dec 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@JakeSteam
Copy link

JakeSteam commented Dec 23, 2024

Describe the bug

Trying to use the library with Compose versions 1.7.1 and above will result in an app crash.

To Reproduce

  1. Try to display the dialog.
  2. See the following stack trace:
FATAL EXCEPTION: main
	Process: com.myapp, PID: 29211
	java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/material/icons/Icons;
		at com.vanpra.composematerialdialogs.datetime.date.DatePickerKt.CalendarViewHeader(DatePicker.kt:266)
		at com.vanpra.composematerialdialogs.datetime.date.DatePickerKt.access$CalendarViewHeader(DatePicker.kt:1)
		at com.vanpra.composematerialdialogs.datetime.date.DatePickerKt$DatePickerImpl$1$1.invoke(DatePicker.kt:134)
		at com.vanpra.composematerialdialogs.datetime.date.DatePickerKt$DatePickerImpl$1$1.invoke(DatePicker.kt:124)
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.compose.material.icons.Icons" on path: DexPathList[[zip file "/data/app/~~rwJMsw9MrszunlanowPNmw==/au.com.seatfrog.icarus.dev-xtk1iU-7_ERqdGHO1XOHRg==/base.apk"],nativeLibraryDirectories=[/data/app/~~rwJMsw9MrszunlanowPNmw==/au.com.seatfrog.icarus.dev-xtk1iU-7_ERqdGHO1XOHRg==/lib/arm64, /data/app/~~rwJMsw9MrszunlanowPNmw==/au.com.seatfrog.icarus.dev-xtk1iU-7_ERqdGHO1XOHRg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:637)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:573)

This is caused by usage of the following files that are no longer included in the androidx.compose.material:material package (despite no relevant release notes mentioned):

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowLeft
import androidx.compose.material.icons.filled.KeyboardArrowRight

Expected behaviour

I expect to see the dialog.

Please complete the following information about your device:

Any device, any OS.

@JakeSteam JakeSteam added the bug Something isn't working label Dec 23, 2024
@JakeSteam
Copy link
Author

JakeSteam commented Dec 23, 2024

One (messy) fix for this is forward porting the specific files this library requires.

So, make sure these 3 files are copied (with unchanged package name) into your app, so they are available for the library:

  1. Icons.kt
  2. KeyboardArrowLeft.kt
  3. KeyboardArrowRight.kt

I've included the source code from Compose 1.7.0 in a GitHub Gist, so just copy these 3 files into your project. You can also find this source code by opening DatePicker.kt and finding the definitions there.

@JakeSteam JakeSteam changed the title Library not compatible with Compose 1.7.5+ Library not compatible with Compose 1.7.1+ Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant