Anyone else having problems to build the ImageView...
# compose-ios
s
Anyone else having problems to build the ImageViewer sample from the current master (as well as 1.4 tag)?
:shared:compileIosMainKotlinMetadata
fails due do not finding coroutine dependencies. I use Mac M1, Xcode 14.3 and Temurin 17.0.5+8.
1
Copy code
sol@MBP-von-Stefan imageviewer % ./gradlew build            
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33

This Android Gradle plugin (7.1.3) was tested up to compileSdk = 32

This warning can be suppressed by adding
    android.suppressUnsupportedCompileSdk=33
to this project's gradle.properties

The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33

> Task :shared:compileIosMainKotlinMetadata FAILED
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:13:27 Unresolved reference: CoroutineScope
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:15:27 Unresolved reference: launc
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:16:27 Unresolved reference: withContext
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:25:18 Unresolved reference: CoroutineScope
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:25:35 Cannot access class 'kotlinx.coroutines.CoroutineScope'. Check your module classpath for missing or conflicting dependencies
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:25:60 Cannot access class 'kotlinx.coroutines.CoroutineDispatcher'. Check your module classpath for missing or conflicting dependencies
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:25:60 Type mismatch: inferred type is CoroutineDispatcher but CoroutineContext was expected
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:42:30 Unresolved reference: CoroutineScope
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:55:45 Suspend function 'getNSDataToShare' should be called only from a coroutine or another suspend function
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:56:21 Unresolved reference: withContext
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt:56:45 Cannot access class 'kotlinx.coroutines.MainCoroutineDispatcher'. Check your module classpath for missing or conflicting dependencies
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/platform.ios.kt:47:39 Cannot access class 'kotlinx.coroutines.CoroutineDispatcher'. Check your module classpath for missing or conflicting dependencies
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/FileExtensions.kt:4:27 Unresolved reference: yield
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/FileExtensions.kt:51:9 Unresolved reference: yield
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:11:27 Unresolved reference: CoroutineScope
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:14:27 Unresolved reference: launch
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:15:27 Unresolved reference: withContext
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:39:26 Unresolved reference: CoroutineScope
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:100:9 Unresolved reference: withContext
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:101:38 Suspension functions can be called only within coroutine body
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:105:9 Unresolved reference: withContext
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:106:29 Suspension functions can be called only within coroutine body
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:109:66 Unresolved reference: withContext
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:109:90 Cannot access class 'kotlinx.coroutines.CoroutineDispatcher'. Check your module classpath for missing or conflicting dependencies
e: file:///Users/sol/Downloads/compose-multiplatform-master/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/storage/IosImageStorage.ios.kt:121:11 Suspension functions can be called only within coroutine body

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:compileIosMainKotlinMetadata'.
> Compilation finished with errors

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at <https://help.gradle.org>

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See <https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings>

BUILD FAILED in 3s
176 actionable tasks: 2 executed, 174 up-to-date
sol@MBP-von-Stefan imageviewer % java --version
openjdk 17.0.5 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode)
m
did you installed:
brew install kdoctor
check this repo if your app would build/run https://github.com/JetBrains/compose-multiplatform-template
s
Yes, I checked kdoctor. I re-installed CocoaPods using brew and removed the ruby version, but the warning stays. 🤷‍♂️ But CocoaPods seem to work.
Copy code
sol@MBP-von-Stefan ~ % kdoctor
Environment diagnose (to see all details, use -v option):
[✓] Operation System
[✓] Java
[✖] Android Studio
 ✖ No Android Studio installation found
  Get Android Studio from <https://developer.android.com/studio>
[✓] Xcode
[✖] Cocoapods
 ✖ System ruby is currently used
  CocoaPods is not compatible with system ruby installation on Apple M1 computers.
  Please install ruby via Homebrew, rvm, rbenv or other tool and make it default
  Detailed information: <https://stackoverflow.com/questions/64901180/how-to-run-cocoapods-on-apple-silicon-m1/66556339#66556339>
 ✖ CocoaPods requires your terminal to be using UTF-8 encoding.
  Consider adding the following to ~/.zprofile
  export LC_ALL=en_US.UTF-8
m
which ruby version is Cocoapods using?
s
I don't know.
which ruby
points to
/usr/bin/ruby
. Since the template compiles I doubt that this is the problem.
Does the imageviewer compile for you?
m
/usr/bin/ruby -v
mom
s
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin22]
m
commit id
s
Current master (cbdb0eb), but also released 1.4.0 don't work for me
m
gradlew build throws the same error, but do you want to run the ios app?
s
Yes, I wanted to check out the iOS app and see how it performs compared to the other platforms.
Okay, so it's not only for me. Thank you for confirming. I will fill out a bug report.
m
the ios app runs just with “Configuration” and play button
image.png
s
I need to install that plugin. Until now I started from Xcode. I got used to that because in the past the plugin did not work very good.
Thank you for that hint.
Which IDE do you use? I'm on IDEA 2023.1 and have Compose Multiplatform IDE Support installed, but the iOS run configuration does not show up. 🤔
m
I am using it with android studio
yeah.. without the plugin it should be hard 😛
s
I'm happy to switch to the plugin if it works well. A year ago that wasn't exactly the case. 😄
m
What does a year mean in Dev World XD
For KMM I would recommend to use android studio for running the iosApp. in idea it doesn’t work with ios Configuration
hope I could helped you 🙂
s
Yes, you did. Thank you for your input. 🙏