010598
2023/08/07(月) 15:30:19.77ID:bKCC1GJDコンパイルは出来ましたが
Exception in thread "main" java.lang.NoClassDefFoundError: kotlinx/coroutines/GlobalScope
at C001Kt.main(c001.kt:4)
at C001Kt.main(c001.kt)
Caused by: java.lang.ClassNotFoundException: kotlinx.coroutines.GlobalScope
...
chatgptに聞いたりググったりして
gradle init --dsl kotlin
2 enter 4 enter ...
などとしてみてapp/build.gradle.ktsのdependenciesに
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
を書いて./gradlew runしてみましたが
> Task :app:compileKotlin
w: file:///hoge/kt/c001/app/src/main/kotlin/c001/App.kt:4:5 This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
そもそもkotlinx.coroutines.*とkotlin.coroutines.*があるようですが
コンソールアプリで使えるのは後者なのでしょうか
もしそうだとすると上のサンプルコード自体コンソールでは使えないかもしれません
色々試してみていますがまだうまく動かせていません
初心者すぎてすいません