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

Gradle sync fails after upgrading from 0.23.0 to 0.24.x #784

Open
vojta-horanek opened this issue Nov 7, 2024 · 0 comments
Open

Gradle sync fails after upgrading from 0.23.0 to 0.24.x #784

vojta-horanek opened this issue Nov 7, 2024 · 0 comments

Comments

@vojta-horanek
Copy link

Our project fails to be synced (specifically the KMP module) after updating moko-resources to 0.24.3 from 0.23.0. As I've tested, the same happens when using any of the other 0.24.x versions. The build (Android and iOS) is working fine, however android studio fails to sync and thus indexing is not working correctly. What is strange is that if XCode runs the copyResourcesKMMSharedDomainDebugXCFrameworkToApp task, it completes successfully and resources are indeed copied to the iOS application.

The following issue is displayed when trying to sync:

Unable to build Kotlin project configuration
Failed building KotlinMPPGradleModel

org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':shared:copyResourcesKMMSharedDomainXCFrameworkToApp'.

...

Caused by: java.lang.ClassCastException: class org.gradle.api.DefaultTask_Decorated cannot be cast to class org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkTask (org.gradle.api.DefaultTask_Decorated is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @277c0f21; org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkTask is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @5fb60b55)

The name KMMSharedDomain comes from using configureCopyXCFrameworkResources("KMMSharedDomain") in the configuration.

I've experimented a bit and found out that when I don't use configureCopyXCFrameworkResources in the configuration, the sync actually completes just fine -> obvious since the task does not get registered 😄

I suspect the cast in SetupAppleUtils:registerCopyXCFrameworkResourcesToAppTask is the cause of the issue.

This is a screenshot from the debugger evaluating this.project.tasks.getByName("assemble$xcFrameworkName") right before the sync crashes.
Snímek obrazovky 2024-11-07 v 14 04 58

Thanks in advance.

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

1 participant