mirzemehdi / KMPAuth

Kotlin Multiplatform Authentication Library targetting android and iOS
https://mirzemehdi.com/KMPAuth/
Apache License 2.0
231 stars 19 forks source link

Kotlin 2.0 support? #24

Closed shoheikawano closed 5 months ago

shoheikawano commented 5 months ago

First of all thank you for your useful library! I have used this library for my multiplatform project and it worked well until I updated Kotlin version in my project to 2.0.0.

When I try to use the library with my project with Kotlin 2.0.0 it crashes with the following error:

  PACKAGE_NAME    E  FATAL EXCEPTION: main 
  Process: PACKAGE_NAME, PID: 17314
        java.lang.NoSuchMethodError: No direct method <init>(Ljava/util/Set;Ljava/lang/String;)V in class Lorg/jetbrains/compose/resources/ResourceItem; or its super classes (declaration of 'org.jetbrains.compose.resources.ResourceItem' appears in /data/app/~~3jFpP3Rk6PBa7ub-ZncbjA==/PACKAGE_NAME-orEdgfzmOvPRDEW3Uuoa3Q==/base.apk!classes2.dex)
        at io.github.mirzemehdi.kmpauth_uihelper.generated.resources.Drawable0Kt.init_ic_apple_logo_white(Drawable0.kt:43)
        at io.github.mirzemehdi.kmpauth_uihelper.generated.resources.Drawable0Kt.access$init_ic_apple_logo_white(Drawable0.kt:1)
        at io.github.mirzemehdi.kmpauth_uihelper.generated.resources.Drawable0$ic_apple_logo_white$2.invoke(Drawable0.kt:15)
        at io.github.mirzemehdi.kmpauth_uihelper.generated.resources.Drawable0$ic_apple_logo_white$2.invoke(Drawable0.kt:15)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at io.github.mirzemehdi.kmpauth_uihelper.generated.resources.Drawable0.getIc_apple_logo_white(Drawable0.kt:15)
        at io.github.mirzemehdi.kmpauth_uihelper.generated.resources.Drawable0Kt.getIc_apple_logo_white(Drawable0.kt:36)
        at com.mmk.kmpauth.uihelper.apple.AppleSignInButtonKt.AppleIcon(AppleSignInButton.kt:147)
        at com.mmk.kmpauth.uihelper.apple.AppleSignInButtonKt.access$AppleIcon(AppleSignInButton.kt:1)
        at com.mmk.kmpauth.uihelper.apple.AppleSignInButtonKt$AppleSignInButtonIconOnly$2.invoke(AppleSignInButton.kt:72)
        at com.mmk.kmpauth.uihelper.apple.AppleSignInButtonKt$AppleSignInButtonIconOnly$2.invoke(AppleSignInButton.kt:71)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.material3.ButtonKt$Button$3$1.invoke(Button.kt:93)
        at androidx.compose.material3.ButtonKt$Button$3$1.invoke(Button.kt:134)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
        at androidx.compose.material3.ProvideContentColorTextStyleKt.ProvideContentColorTextStyle-3J-VO9M(ProvideContentColorTextStyle.kt:39)
        at androidx.compose.material3.ButtonKt$Button$3.invoke(Button.kt:132)
        at androidx.compose.material3.ButtonKt$Button$3.invoke(Button.kt:131)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.material3.SurfaceKt$Surface$3.invoke(Surface.kt:243)
        at androidx.compose.material3.SurfaceKt$Surface$3.invoke(Surface.kt:221)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
        at androidx.compose.material3.SurfaceKt.Surface-o_FOJdg(Surface.kt:218)
        at androidx.compose.material3.ButtonKt.Button(Button.kt:120)
        at com.mmk.kmpauth.uihelper.apple.AppleSignInButtonKt.AppleSignInButtonIconOnly(AppleSignInButton.kt:60)
        at PACKAGE_NAME.shared.ui.mypage.ComposableSingletons$MyPageScreenKt$lambda-4$1.invoke(MyPageScreen.kt:97)
        at PACKAGE_NAME.shared.ui.mypage.ComposableSingletons$MyPageScreenKt$lambda-4$1.invoke(MyPageScreen.kt:96)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at com.mmk.kmpauth.firebase.oauth.OAuthContainer_androidKt.OAuthContainer(OAuthContainer.android.kt:34)
        at com.mmk.kmpauth.firebase.apple.AppleButtonUiContainerKt.AppleButtonUiContainer(AppleButtonUiContainer.kt:42)
2024-05-29 16:41:41.018 17314-17314 AndroidRuntime          PACKAGE_NAME          E     at PACKAGE_NAME.shared.ui.mypage.MyPageScreenKt.MyPage(MyPageScreen.kt:86) (Ask Gemini)
        at PACKAGE_NAME.shared.ui.mypage.MyPageUiFactory$create$$inlined$ui$1.Content(Ui.kt:97)
        at com.slack.circuit.foundation.CircuitContentKt.CircuitContent(CircuitContent.kt:162)
        at com.slack.circuit.foundation.CircuitContentKt.CircuitContent(CircuitContent.kt:114)
        at com.slack.circuit.foundation.CircuitContentKt$CircuitContent$3.invoke(CircuitContent.kt:92)
        at com.slack.circuit.foundation.CircuitContentKt$CircuitContent$3.invoke(CircuitContent.kt:91)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248)
        at com.slack.circuit.foundation.CircuitContentKt.CircuitContent(CircuitContent.kt:91)
        at com.slack.circuit.foundation.NavigableCircuitContentKt$buildCircuitContentProviders$createRecordContent$1$1$1.invoke(NavigableCircuitContent.kt:189)
        at com.slack.circuit.foundation.NavigableCircuitContentKt$buildCircuitContentProviders$createRecordContent$1$1$1.invoke(NavigableCircuitContent.kt:188)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
        at com.slack.circuit.foundation.NavigableCircuitContentKt$buildCircuitContentProviders$createRecordContent$1$1.invoke(NavigableCircuitContent.kt:184)
        at com.slack.circuit.foundation.NavigableCircuitContentKt$buildCircuitContentProviders$createRecordContent$1$1.invoke(NavigableCircuitContent.kt:177)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248)
        at com.slack.circuit.foundation.NavigableCircuitContentKt$buildCircuitContentProviders$createRecordContent$1.invoke(NavigableCircuitContent.kt:177)
        at com.slack.circuit.foundation.NavigableCircuitContentKt$buildCircuitContentProviders$createRecordContent$1.invoke(NavigableCircuitContent.kt:168)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.runtime.ComposerImpl$invokeMovableContentLambda$1.invoke(Composer.kt:3005)
        at androidx.compose.runtime.ComposerImpl$invokeMovableContentLambda$1.invoke(Composer.kt:3005)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
        at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:90)
        at androidx.compose.runtime.ComposerImpl.invokeMovableContentLambda(Composer.kt:3005)
        at androidx.compose.runtime.ComposerImpl.access$invokeMovableContentLambda(Composer.kt:1232)
        at androidx.compose.runtime.ComposerImpl$insertMovableContentGuarded$1$1$1$1.invoke(Composer.kt:3069)
        at androidx.compose.runtime.ComposerImpl$insertMovableContentGuarded$1$1$1$1.invoke(Composer.kt:3065)
        at androidx.compose.runtime.ComposerImpl.recomposeMovableContent(Composer.kt:3193)
        at androidx.compose.runtime.ComposerImpl.recomposeMovableContent$default(Composer.kt:3172)
        at androidx.compose.runtime.ComposerImpl.insertMovableContentGuarded(Composer.kt:3065)
        at androidx.compose.runtime.ComposerImpl.insertMovableContentReferences(Composer.kt:3023)
        at androidx.compose.runtime.CompositionImpl.insertMovableContent(Composition.kt:954)
        at androidx.compose.runtime.Recomposer.performInsertValues(Recomposer.kt:1176)
2024-05-29 16:41:41.019 17314-17314 AndroidRuntime          PACKAGE_NAME          E     at androidx.compose.runtime.Recomposer.access$performInsertValues(Recomposer.kt:127) (Ask Gemini)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:616)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:551)
        at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
        at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
        at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
        at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1397)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1408)
        at android.view.Choreographer.doCallbacks(Choreographer.java:1008)
        at android.view.Choreographer.doFrame(Choreographer.java:934)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1382)
        at android.os.Handler.handleCallback(Handler.java:959)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loopOnce(Looper.java:232)
        at android.os.Looper.loop(Looper.java:317)
        at android.app.ActivityThread.main(ActivityThread.java:8501)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
        Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@5cdac44, androidx.compose.ui.platform.MotionDurationScaleImpl@3a7412d, StandaloneCoroutine{Cancelling}@9e0a662, AndroidUiDispatcher@924e3f3]

I believe updating Kotlin version to 2.0 resolves this issue for all projects using Kotlin 2.0. I forked this project, updated the version and checked to see if sample project works, and it worked, so I made a PR for updating Kotlin 2.0.

It would be amazing if you check the PR, tell me or edit directly for any necessary changes, and hopefully publish a new version of the library with Kotlin 2.0 compatibility.

Thanks in advance!