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

No file for error Composable function in Native Compose (Darwin Compose) #2560

Closed
TaehoonLeee opened this issue Dec 14, 2022 · 2 comments
Closed

Comments

@TaehoonLeee
Copy link
Contributor

JetBrains Compose : 1.2.1
Kotlin : 1.7.20

I tried to use JetBrains Compose in iOS.

I export Compose UI like this

fun createExampleViewController(
    rootComponent: RootComponent
): UIViewController = Application("Example") {
    ExampleApp(rootComponent)
}

@Composable
@OptIn(ExperimentalDecomposeApi::class)
fun ExampleApp(rootComponent: RootComponent) {
    Scaffold(
        bottomBar = {
            BottomBar(rootComponent)
        }
    ) {
        Children(rootComponent.childStack) {
            when (val child = it.instance) {
                is RootComponent.Child.Item -> ItemScreen(child.component)
                is RootComponent.Child.Gallery -> GalleryScreen(child.component)
                is RootComponent.Child.Empty -> Spacer(Modifier.fillMaxSize())
            }
        }
    }
}

However, if I execute assembleExampleXCFramework, an error occurs in the linkDebugFrameworkIosArm64 task.
java.lang.IllegalStateException: No file for com.example.presentation.root/ExampleApp|-5619709659753561405[0]

I don't know what I missed to implement.

My Gradle file is like this

import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
	alias(libs.plugins.android.library)
	alias(libs.plugins.jetbrains.compose)
	alias(libs.plugins.kotlin.multiplatform)
	id("kotlin-parcelize")
}

kotlin {
	val xcFramework = XCFramework("Example")
	ios {
		binaries.framework {
			isStatic = true
			baseName = "Example"
			xcFramework.add(this)
		}
	}
	android()

	sourceSets.commonMain {
		dependencies {
			implementation(projects.domain)
			implementation(projects.features.item)
			implementation(projects.features.gallery)

			implementation(compose.foundation)
			implementation(compose.material)

			implementation(libs.koin)
			implementation(libs.kotlin.coroutines)
			implementation(libs.bundles.decompose)
		}
	}
}

It works well in android. If anyone knows the cause, I'd appreciate it if you could help me.

@TaehoonLeee
Copy link
Contributor Author

I found the same issue #2346

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants