Skip to content
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

App Crashes while instantiating rememberAdaptiveTimePickerState() #169

Open
saifi369 opened this issue Aug 29, 2024 · 9 comments
Open

App Crashes while instantiating rememberAdaptiveTimePickerState() #169

saifi369 opened this issue Aug 29, 2024 · 9 comments

Comments

@saifi369
Copy link

Hi,
My app is crashing on Android and iOS while instantiating adaptive time picker state.

val state = rememberAdaptiveTimePickerState(
                    initialHour = 12,
                    initialMinute = 10,
                    is24Hour = true
                )

I'm getting this exception:

java.lang.InstantiationError: androidx.compose.material3.TimePickerState
                                                                                                    	at com.mohamedrejeb.calf.ui.timepicker.AdaptiveTimePickerState.<init>(AdaptiveTimePickerState.material.kt:35)
                                                                                                    	at com.mohamedrejeb.calf.ui.timepicker.AdaptiveTimePickerStateKt.rememberAdaptiveTimePickerState$lambda$1$lambda$0(AdaptiveTimePickerState.kt:17)
                                                                                                    	at com.mohamedrejeb.calf.ui.timepicker.AdaptiveTimePickerStateKt.$r8$lambda$7dEtWSPSD9VEsYQkVJY_7cp3ftU(Unknown Source:0)
                                                                                                    	at com.mohamedrejeb.calf.ui.timepicker.AdaptiveTimePickerStateKt$$ExternalSyntheticLambda0.invoke(Unknown Source:6)
                                                                                                    	at androidx.compose.runtime.saveable.RememberSaveableKt.rememberSaveable(RememberSaveable.kt:89)
                                                                                                    	at com.mohamedrejeb.calf.ui.timepicker.AdaptiveTimePickerStateKt.rememberAdaptiveTimePickerState(AdaptiveTimePickerState.kt:14)

PS: I've tested the AlertDialog and that works fine.

@MohamedRejeb
Copy link
Owner

Thanks for reporting this issue. Can you share the versions you are using.

@saifi369
Copy link
Author

saifi369 commented Sep 1, 2024

I'm using these versions.

calf = "0.5.5"
compose = "1.6.11"
kotlin = "2.0.10"

@MohamedRejeb
Copy link
Owner

I will check it.

@MohamedRejeb
Copy link
Owner

Couldn't reproduce it. Can you try the app sample and let me know if it happens for you there as well?

@saifi369
Copy link
Author

saifi369 commented Sep 3, 2024

I've tried on a blank project and it works without any issue but crashes on my main project.
I'm attaching the project link if you want to investigate further. You can try the main branch, application will crash during the onboarding screens.
https://github.com/saifi369/KMP-ExpenseTracker

App crashes on this line : https://github.com/saifi369/KMP-ExpenseTracker/blob/c8042091c424a9455f06887dab1187c4eed951ed/composeApp/src/commonMain/kotlin/presentation/screen/accountsetup/AccountSetupScreen.kt#L157

@MohamedRejeb
Copy link
Owner

I will check it.

@saifi369
Copy link
Author

saifi369 commented Sep 3, 2024

@MohamedRejeb I've resolved the issue after changing the compose-plugin from 1.7.0-alpha0 to 1.6.11. My bad 😆
Please feel free to close this.

@saifi369
Copy link
Author

saifi369 commented Sep 7, 2024

Hi @MohamedRejeb

After downgrading to compose 1.6.11, app works fine on Android but I'm getting this exception for iOS.

> Task :composeApp:compileKotlinIosSimulatorArm64
Failed to load native library:libjansi.jnilib. The native library file at /Users/saifi369/.gradle/native/jansi/1.18/osx/libjansi.jnilib is not executable, make sure that the directory is mounted on a partition without the noexec flag, or set the jansi.tmpdir system property to point to a proper location.  osinfo: Mac/arm64
java.lang.UnsatisfiedLinkError: /Users/saifi369/.gradle/native/jansi/1.18/osx/libjansi.jnilib: dlopen(/Users/saifi369/.gradle/native/jansi/1.18/osx/libjansi.jnilib, 0x0001): tried: '/Users/saifi369/.gradle/native/jansi/1.18/osx/libjansi.jnilib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/saifi369/.gradle/native/jansi/1.18/osx/libjansi.jnilib' (no such file), '/Users/saifi369/.gradle/native/jansi/1.18/osx/libjansi.jnilib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

I also tried running the project from XCode but that fails as well.

@MohamedRejeb
Copy link
Owner

Not sure if this error is related to adaptive time picker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants