Open8
Compose Multiplatform
初期設定
ダウンロードできたらIntelliJ IDEA UltimateでOpenする。
Run Application
Runする
以下のエラーが出力される
Caused by: com.android.builder.errors.EvalIssueException: Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;33.0.1 Android SDK Build-Tools 33.0.1
platforms;android-34 Android SDK Platform 34
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
All licenses can be accepted using the sdkmanager command line tool:
sdkmanager.bat --licenses
Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle
対応方法
歯車マークを押下して、Android SDK Managerを開く
Editを開く
Nextを押して進めていく
Data層の実装
Data層の共通化を図るためにcommonMain
にnetwork, data layerを追加する
HttpClientの実装を共通化するため以下をcommonMain
のdependenciesに追加
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-darwin = { module = "io.ktor:ktor-client-ios", version.ref = "ktor" }
参考:
kotlin-wasmをprojectに入れているとcommonMain
にktor-client-core
を入れるとエラーが出る
No matching variant of io.ktor:ktor-client-core:2.3.7 was found
ktorのversionがkotlin-wasmプラットフォームに対応していないのが原因
wasmJsをbuild.gradleから取り除くことで解決
一旦build.gradle
は以下のように設定
sourceSets {
androidMain.dependencies {
implementation(libs.ktor.client.okhttp)
}
commonMain.dependencies {
implementation(libs.ktor.client.core)
}
iosMain.dependencies {
implementation(libs.ktor.client.darwin)
}
}