大佬教程收集整理的这篇文章主要介绍了Kotlin Multiplatform Mobile:项目已经有一个名为 SDWebImage 的 CocoaPods 依赖项,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我创建了一个演示项目来将 cocoapods 集成到 KMM 项目中。我已从官方网站关注此 link。在 step 3
重新导入项目时,我收到以下错误。
Project already has a CocoaPods dependency with name SDWebImage
,之后我什至无法在 KMM 中导入这个库。
有人可以帮忙吗?
更新:添加 build.gradle.kts
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
ID("com.androID.library")
kotlin("native.cocoapods")
}
// CocoaPods requires the podspec to have a version.
version = "1.0"
kotlin {
androID()
ios {
cocoapods {
// Configure fIElds required by CocoaPods.
sumMary = "Some description for a Kotlin/Native module"
homepage = "link to a Kotlin/Native module homepage"
pod("SDWebImage")
// You can change the name of the produced framework.
// By default,it is the name of the Gradle project.
frameworkname = "shared"
}
}
sourceSets {
val commonMain by getTing
val commonTest by getTing {
dependencIEs {
implementation(kotlin("test-common"))
implementation(kotlin("test-Annotations-common"))
}
}
val androIDMain by getTing {
dependencIEs {
implementation("com.Google.androID.material:material:1.2.1")
}
}
val androIDTest by getTing {
dependencIEs {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13")
}
}
val iosmain by getTing
val iosTest by getTing
}
}
androID {
compileSdkVersion(29)
sourceSets["main"].manifest.srcfile("src/androIDMain/AndroIDManifest.xml")
defaultConfig {
minSdkVersion(24)
targetSdkVersion(29)
}
}
val packForXcode by tasks.creaTing(Sync::class) {
group = "build"
val mode = System.getenv("CONfigURATION") ?: "DEBUG"
val sdkname = System.getenv("SDK_name") ?: "iphonesimulator"
val targetname = "ios" + if (sdkname.startsWith("iphoneos")) "Arm64" else "X64"
val framework = kotlin.targets.getByname<KotlinNativeTarget>(targetName).binarIEs.getFramework(modE)
inputs.property("mode",modE)
dependsOn(framework.linkTask)
val targetDir = file(buildDir,"xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByname("build").dependsOn(packForXcodE)
当您使用 cocoapods 插件时,您不需要手动声明 packForXcode
目标,也许这就是问题所在。尝试在 val packForXcode
cocoapods
部分应该在 kotlin
内,而不是在 ios
以上是大佬教程为你收集整理的Kotlin Multiplatform Mobile:项目已经有一个名为 SDWebImage 的 CocoaPods 依赖项全部内容,希望文章能够帮你解决Kotlin Multiplatform Mobile:项目已经有一个名为 SDWebImage 的 CocoaPods 依赖项所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。