ismai117 / kottie

Render After Effects Animations Library - Compose Multiplatform | Inspired by Airbnb/Lottie

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue on adding library to project

anuragdalia opened this issue · comments

Only adding the library causes this. I havent done anything other than adding this to commonMain dependencies. And clues?

objc[90768]: Class AKAlertImageURLProvider is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKitUI.framework/AuthKitUI (0x1636fadd8) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKit.framework/AuthKit (0x13cc30218). One of the two will be used. Which one is undefined.
objc[90768]: Class AKBiometricRatchetUtility is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKitUI.framework/AuthKitUI (0x1636fae50) and /Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AuthKit.framework/AuthKit (0x13cc31820). One of the two will be used. Which one is undefined.
Class NotificationLambdaTarget has multiple implementations. Which one will be used is undefined.
Class ControlLambdaTarget has multiple implementations. Which one will be used is undefined.
Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError.
It is considered unexpected and unhandled instead. Program will be terminated.
Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError: Can not get instance of singleton 'Plugin': No class found for symbol 'io.ktor.client.plugins.observer/ResponseObserver.Plugin|null[0]'

    at 0   app                           0x10f411cd9        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 105 
    at 1   app                           0x10f40c0b5        kfun:kotlin.Error#<init>(kotlin.String?){} + 101 
    at 2   app                           0x10f44bca5        kfun:kotlin.native.internal.IrLinkageError#<init>(kotlin.String?){} + 101 
    at 3   app                           0x10f44bd58        kfun:kotlin.native.internal#ThrowIrLinkageError(kotlin.String?){}kotlin.Nothing + 168 
    at 4   app                           0x10f8df185        kfun:io.ktor.client.plugins.logging.Logging.setupResponseLogging#internal + 869 
    at 5   app                           0x10f8df978       

Is there anything beyond this that i can share i am on kotlin2.0.0+

I realised its probably because of a mismatch of ktor version. using ktor3.0.0+ breaks my app elsewhere because of some cInterops issue. trying to figure out. will keep this thread updated.

Also is there a possibility to disable a particular platform target when adding this library. for example i dont need the wasm support in my project. but it'll still be processed when i add the library i guess.

I seem to have the same problem.

[versions]
agp = "8.2.0"
android-compileSdk = "34"
android-minSdk = "24"
android-targetSdk = "34"
compose = "1.6.5"
compose-plugin = "1.6.10-beta01"
kotlin = "1.9.23"
activity-compose = "1.8.2"
voyager = "1.1.0-alpha04"
kotlinxSerializationJson = "1.6.3"
ktor = "2.3.10"
koin = "3.5.3"
kermit = "2.0.3"
multiplatform-settings = "1.1.1"
landscapistCoil3 = "2.3.3"
lottie = "1.7.3"

Screenshot at Apr 27 11-22-19

I'm trying to figure out how to resolve this error.

I managed to implement this step

1

I'm having trouble executing json locally. To run the animation via URL it works normally.

My json file works normally in an Android project or on the website: https://lottiefiles.com/tools/lottie-json-to-optimized-lottie-json

FATAL EXCEPTION: main
Process: br.com.compropay.app, PID: 17805
java.lang.NoSuchMethodError: No static method readResourceBytes(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; in class Lorg/jetbrains/compose/resources/ResourceReader_androidKt; or its super classes (declaration of 'org.jetbrains.compose.resources.ResourceReader_androidKt' appears in /data/app/~~McOFu9gQvV5j-g9dhLif0Q==/br.com.compropay.app-8sCJM13hOotQCsguIfJutQ==/base.apk!classes19.dex)
	at kottieComposition.KottieComposition_androidKt$kottieComposition$1.invokeSuspend(KottieComposition.android.kt:23)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
	at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
	at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:68)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1648)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1659)
	at android.view.Choreographer.doCallbacks(Choreographer.java:1129)
	at android.view.Choreographer.doFrame(Choreographer.java:1045)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1622)
	at android.os.Handler.handleCallback(Handler.java:958)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:230)
	at android.os.Looper.loop(Looper.java:319)
	at android.app.ActivityThread.main(ActivityThread.java:8893)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@38f7e05, androidx.compose.runtime.BroadcastFrameClock@95c5e5a, StandaloneCoroutine{Cancelling}@4afc88b, AndroidUiDispatcher@474ed68]

1

I'm having trouble executing json locally. To run the animation via URL it works normally.

My json file works normally in an Android project or on the website: https://lottiefiles.com/tools/lottie-json-to-optimized-lottie-json

FATAL EXCEPTION: main
Process: br.com.compropay.app, PID: 17805
java.lang.NoSuchMethodError: No static method readResourceBytes(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; in class Lorg/jetbrains/compose/resources/ResourceReader_androidKt; or its super classes (declaration of 'org.jetbrains.compose.resources.ResourceReader_androidKt' appears in /data/app/~~McOFu9gQvV5j-g9dhLif0Q==/br.com.compropay.app-8sCJM13hOotQCsguIfJutQ==/base.apk!classes19.dex)
	at kottieComposition.KottieComposition_androidKt$kottieComposition$1.invokeSuspend(KottieComposition.android.kt:23)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
	at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
	at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:68)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1648)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1659)
	at android.view.Choreographer.doCallbacks(Choreographer.java:1129)
	at android.view.Choreographer.doFrame(Choreographer.java:1045)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1622)
	at android.os.Handler.handleCallback(Handler.java:958)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:230)
	at android.os.Looper.loop(Looper.java:319)
	at android.app.ActivityThread.main(ActivityThread.java:8893)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@38f7e05, androidx.compose.runtime.BroadcastFrameClock@95c5e5a, StandaloneCoroutine{Cancelling}@4afc88b, AndroidUiDispatcher@474ed68]

1

Looks like there are two problems here

  1. Need to bump the version of compose multiplatform in kottie to 1.6.10, since binary compatibility may have broken
  2. Need to explicitly use Res.readBytes, since it calls readResourceBytes("composeResources/com.test.myModule.resources.generated.resources/" + path). Related to JetBrains/compose-multiplatform#4656
    readResourceBytes(spec.path).decodeToString()

thanks @tipapro , I've fixed it and released a new version 1.8.5. it's now using Res.readBytes

thanks @tipapro , I've fixed it and released a new version 1.8.5. it's now using Res.readBytes

Every module has its own Res.readBytes and its own path. So Res.readBytes inside the library won't work due to the different path

@tipapro yeah I noticed that, it wasn't working with the k2 compiler and compose compiler 1.6.10 versions

Can this be considered resolved or will there still be a solution?

I've released a new version 1.8.6. Res.readBytes has been removed from the library module so you now have the option to do it yourself.

var animation by remember { mutableStateOf("") }

LaunchedEffect(Unit){
    animation = Res.readBytes("files/animation.json").decodeToString()
}

val composition = rememberKottieComposition(
    spec = KottieCompositionSpec.File(animation) // Or KottieCompositionSpec.Url || KottieCompositionSpec.JsonString
)

I seem to have the same problem.

[versions] agp = "8.2.0" android-compileSdk = "34" android-minSdk = "24" android-targetSdk = "34" compose = "1.6.5" compose-plugin = "1.6.10-beta01" kotlin = "1.9.23" activity-compose = "1.8.2" voyager = "1.1.0-alpha04" kotlinxSerializationJson = "1.6.3" ktor = "2.3.10" koin = "3.5.3" kermit = "2.0.3" multiplatform-settings = "1.1.1" landscapistCoil3 = "2.3.3" lottie = "1.7.3"

Screenshot at Apr 27 11-22-19

I'm trying to figure out how to resolve this error.

I have the same problem too.
kotlin = 2.0.0
ktor = 2.3.9
kottie = 1.8.6

you need to add maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental") inside settings.gradle for kottie to work using wasm