笔记笔记
  • Home
  • AI&ML
  • Example
  • Zoo
  • 关于
⌘ K
Kotlin Multiplatform
最后更新时间:
Copyright © 2023-2024 | Powered by dumi | GuoDapeng | 冀ICP备20004032号-1 | 冀公网安备 冀公网安备 13024002000293号

TABLE OF CONTENTS

‌
‌
‌
‌

Kotlin Multiplatform

Kotlin Multiplatform Wizard - 创建项目的引导

官方入门教程

入门教程视频 [youtube]

检查环境

kdoctor

brew install kdoctor 使用这个命令安装检查工具。

项目构建

编辑 gradle/wrapper/gradle-wrapper.properties 文件。因为 gradle-8.9-bin.zip 文件太大,136.11 MB,无法正常下载。

distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.9-bin.zip

编辑 settings.gradle.kts 文件。可以使用 Sonatype Nexus Repository raw 缓存包。

rootProject.name = "MultiplatformDemo"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
pluginManagement {
repositories {
google {
// Sonatype Nexus 的 https://dl.google.com/dl/android/maven2/ 代理
url = uri("http://localhost:8081/repository/google-dl-maven2-proxy/")
isAllowInsecureProtocol = true
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
maven {
// Sonatype Nexus 的 https://plugins.gradle.org/m2/ 代理
url = uri("http://localhost:8081/repository/gradle-plugin-proxy/")
isAllowInsecureProtocol = true
}
maven {
// Sonatype Nexus 的 https://repo.maven.apache.org/maven2/ 代理
url = uri("http://localhost:8081/repository/maven-central/")
isAllowInsecureProtocol = true
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google {
// Sonatype Nexus 的 https://dl.google.com/dl/android/maven2/ 代理
url = uri("http://localhost:8081/repository/google-dl-maven2-proxy/")
isAllowInsecureProtocol = true
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
maven {
// Sonatype Nexus 的 https://plugins.gradle.org/m2/ 代理
url = uri("http://localhost:8081/repository/gradle-plugin-proxy/")
isAllowInsecureProtocol = true
}
maven {
// Sonatype Nexus 的 https://repo.maven.apache.org/maven2/ 代理
url = uri("http://localhost:8081/repository/maven-central/")
isAllowInsecureProtocol = true
}
mavenCentral()
}
}
include(":composeApp")
include(":server")
include(":shared")

ktor-server-tests-jvm-3.0.2.pom 这个包下载不到,貌似仓库里面也没有,虽然有警告,但是貌似不影响开发。