无法解析 com.squareup.sqldelight:native-driver:1.3.0
Posted
技术标签:
【中文标题】无法解析 com.squareup.sqldelight:native-driver:1.3.0【英文标题】:Could not resolve com.squareup.sqldelight:native-driver:1.3.0 【发布时间】:2020-09-07 05:11:35 【问题描述】:我正在尝试构建一个 Kotlin 多平台项目,作为 ios 和 android 应用程序的共享模块。我正在尝试集成 SQLDelight,但在同步 Gradle 时遇到此错误。下面分别是error和build.gradle文件。
错误
。 要求: 项目:
可能的解决方案: - 声明提供工件的存储库,请参阅文档 https://docs.gradle.org/current/userguide/declaring_repositories.html
build.gradle
buildscript
repositories
mavenCentral()
jcenter()
google()
dependencies
classpath 'com.squareup.sqldelight:gradle-plugin:1.3.0'
plugins
id 'org.jetbrains.kotlin.multiplatform' version '1.3.72'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.72'
repositories
mavenCentral()
jcenter()
google()
group 'com.example'
version '0.0.1'
apply plugin: 'com.squareup.sqldelight'
apply plugin: 'maven-publish'
def ktor_version = '1.3.2'
kotlin
jvm()
// This is for iPhone simulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
iosX64("ios")
binaries
framework()
sourceSets
commonMain
dependencies
implementation kotlin('stdlib-common')
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
implementation "com.squareup.sqldelight:native-driver:1.3.0"
commonTest
dependencies
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
jvmMain
dependencies
implementation kotlin('stdlib')
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
implementation "com.squareup.sqldelight:sqlite-driver:1.3.0"
jvmTest
dependencies
implementation kotlin('test')
implementation kotlin('test-junit')
iosMain
dependencies
implementation "io.ktor:ktor-client-ios:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
implementation "com.squareup.sqldelight:native-driver:1.3.0"
iosTest
configurations
compileClasspath
【问题讨论】:
我从 commonMain 依赖项中删除了实现“com.squareup.sqldelight:native-driver:1.3.0”,并且 gradle 同步成功。 【参考方案1】:我删除了
implementation "com.squareup.sqldelight:native-driver:1.3.0"
来自commonMain
的dependecies
。
成功了。
工作build.gradle:
buildscript
repositories
mavenCentral()
jcenter()
google()
dependencies
classpath 'com.squareup.sqldelight:gradle-plugin:1.3.0'
plugins
id 'org.jetbrains.kotlin.multiplatform' version '1.3.72'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.72'
repositories
mavenCentral()
jcenter()
google()
group 'com.example'
version '0.0.1'
apply plugin: 'com.squareup.sqldelight'
apply plugin: 'maven-publish'
def ktor_version = '1.3.2'
kotlin
jvm()
// This is for iPhone simulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
iosX64("ios")
binaries
framework()
sourceSets
commonMain
dependencies
implementation kotlin('stdlib-common')
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
commonTest
dependencies
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
jvmMain
dependencies
implementation kotlin('stdlib')
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
implementation "com.squareup.sqldelight:sqlite-driver:1.3.0"
jvmTest
dependencies
implementation kotlin('test')
implementation kotlin('test-junit')
iosMain
dependencies
implementation "io.ktor:ktor-client-ios:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
implementation "com.squareup.sqldelight:native-driver:1.3.0"
iosTest
configurations
compileClasspath
【讨论】:
以上是关于无法解析 com.squareup.sqldelight:native-driver:1.3.0的主要内容,如果未能解决你的问题,请参考以下文章