russhwolf / multiplatform-hello

Full-stack Hello World for Kotlin Multiplatform
Apache License 2.0
103 stars 5 forks source link

:shared-mobile:linkDebugFrameworkIos FAILED #2

Closed vanniktech closed 4 years ago

vanniktech commented 4 years ago

When cloning the repository & executing buildForXcode, I get the following errors:

> Task :shared-mobile:linkDebugFrameworkIos FAILED
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (3, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (4, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (5, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (6, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (7, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (8, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (9, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (10, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (12, 25): Unresolved reference: HttpClientEngine
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (13, 30): Unresolved reference: HttpClient
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (14, 9): Unresolved reference: defaultRequest
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (15, 13): Unresolved reference: url
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (15, 28): Unresolved reference: URLProtocol
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (16, 13): Unresolved reference: url
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (17, 13): Unresolved reference: url
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (19, 9): Unresolved reference: install
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (19, 17): Unresolved reference: JsonFeature
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (20, 13): Unresolved reference: serializer
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (20, 26): Unresolved reference: KotlinxSerializer
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (22, 9): Unresolved reference: install
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (22, 17): Unresolved reference: Logging
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (26, 9): Unresolved reference: url
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/ApiClient.kt: (27, 13): Unresolved reference: encodedPath
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/hello.kt: (3, 16): Unresolved reference: coroutines
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/hello.kt: (4, 16): Unresolved reference: coroutines
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/hello.kt: (6, 41): Unresolved reference: GlobalScope
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/hello.kt: (8, 21): Suspend function 'getMessage' should be called only from a coroutine or another suspend function
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/httpClientEngine.kt: (3, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/httpClientEngine.kt: (5, 30): Expected property 'httpClientEngine' has no actual declaration in module
The following declaration is incompatible because return type is different:
    public actual val httpClientEngine: [ERROR : HttpClientEngine]

e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/httpClientEngine.kt: (5, 30): Unresolved reference: HttpClientEngine
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/mainDispatcher.kt: (3, 16): Unresolved reference: coroutines
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/mainDispatcher.kt: (5, 28): Expected property 'mainDispatcher' has no actual declaration in module
The following declaration is incompatible because return type is different:
    public actual val mainDispatcher: [ERROR : CoroutineDispatcher]

e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/commonMain/kotlin/mainDispatcher.kt: (5, 28): Unresolved reference: CoroutineDispatcher
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/httpClientEngine.kt: (3, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/httpClientEngine.kt: (4, 8): Unresolved reference: io
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/httpClientEngine.kt: (6, 30): Actual property 'httpClientEngine' has no corresponding expected declaration
The following declaration is incompatible because return type is different:
    public expect val httpClientEngine: [ERROR : HttpClientEngine]

e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/httpClientEngine.kt: (6, 30): Unresolved reference: HttpClientEngine
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/httpClientEngine.kt: (6, 49): Unresolved reference: Ios
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/mainDispatcher.kt: (3, 16): Unresolved reference: coroutines
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/mainDispatcher.kt: (4, 16): Unresolved reference: coroutines
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/mainDispatcher.kt: (10, 28): Actual property 'mainDispatcher' has no corresponding expected declaration
The following declaration is incompatible because return type is different:
    public expect val mainDispatcher: [ERROR : CoroutineDispatcher]

e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/mainDispatcher.kt: (10, 28): Unresolved reference: CoroutineDispatcher
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/mainDispatcher.kt: (14, 5): Unresolved reference: CoroutineDispatcher
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/mainDispatcher.kt: (15, 5): 'dispatch' overrides nothing
e: /Users/niklas/fresh/multiplatform-hello/shared-mobile/src/iosMain/kotlin/mainDispatcher.kt: (15, 61): Unresolved reference: Runnable

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared-mobile:linkDebugFrameworkIos'.
> Process 'command '/Applications/Android Studio 3.6 Preview.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

Is there anything special I need to do?

russhwolf commented 4 years ago

Not sure off-hand what's going wrong. Are you using an IDE run task or calling gradle directly from command-line?

Also, note that buildForXcode is intended to be run as part of the xcode build process and not invoked directly. I don't think that's causing your issue though.

vanniktech commented 4 years ago

Directly from the command line. I ended up using packForXCode from:

https://github.com/kotlin-hands-on/mpp-ios-android/blob/8cfc677610d2d469b6201155a5d5d513a46d6e89/SharedCode/build.gradle.kts#L35

which does work. Didn't work from Xcode either (same build failure)