我试图在shared项目的模块中编写测试。在共享模块的build.gradle.kts文件中,我有以下内容:
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
//TOD
我只想在我的Kotlin多平台commonTest代码中看到几个简单println(...)的输出。我的build.gradle.kts看起来有点像:
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform") version "1.3.61"
kotlin("plugin.serialization") version "1.3.61"
}
kotlin {
so
我有一个具有多个模块的项目。其中一个模块是kotlin多平台。我正在尝试使用Kotest 4.1.1为它添加单元测试。此版本发布在存储库mavenCentral()中,我可以在使用java库插件的模块中很好地使用此版本。但在多平台模块中使用Kotest 4.1.1时,每次尝试同步都会失败: Could not resolve io.kotest:kotest-runner-junit5-jvm:4.1.1. 我不明白为什么会这样。这个错误肯定是由于使用kotlin多平台插件的模块造成的,因为同一项目中使用常规kotlin jvm插件的不同模块和相同版本的kotest可以很好地同步。因此,gr
我正在尝试将RealmSwift添加为我的Kotlin multiplaform库项目的iOS目标的依赖项。我得到了这个错误:
Execution failed for task ':library:cinteropRealmSwiftIos'.
> Process 'command '/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
我不知道这个gradle任务"
我正在为Android和iOS构建一个多平台库。我的梯度文件如下所示:
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.4.0'
}
repositories {
mavenCentral()
}
group 'com.example'
version '0.0.1'
apply plugin: 'maven-publish'
kotlin {
jvm()
// This is for iPhone sim
我有一个多项目gradle与四个Kotlin多平台模块,其中两个有测试。当我运行gradle check时,如果其中一个模块的任何测试失败,则不会执行另一个模块的测试。
我正在使用Gradle 7.3、Java17和kotlin.test。两个项目的测试都位于commonTest源代码集中。还使用相同的行为尝试了Gradle 7.1和Java 11。
settings.gradle.kts摘录
include(":ProjectA")
include(":ProjectB") // B has tests and depends on D, its tests
我不知道如何在kotlin多平台项目中获得commonMain依赖项。我已经看了很多次文档,看了很多例子,但它只是不起作用。下面是我认为应该奏效的最小的例子。我做错了什么?
多平台库
plugins {
kotlin("multiplatform") version "1.3.61"
`maven-publish`
}
group = "github.fatalcatharsis"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
ma
我使用Intellij2019.3.1创建了一个多平台项目。该项目仅包含Idea创建的默认示例类。我正在尝试使用IntelliIdea(2019.3.1)在kotlin 1.3.61中运行java测试。当我尝试运行jvm测试时,它显示为fail with FAILURE: Build failed with exception。
* What went wrong:
Execution failed for task ':jvmTest'.
> No tests found for given includes: [sample.TestJava](filter.incl
我有一个多平台库,可以用Ktor执行一些API调用(2.0.0-beta-1)
class DiscoveryServicesImpl(private val client: HttpClient) : DiscoveryServices {
override suspend fun getServers(domain: String): DAAServers {
return client.get(Servers.Domain(domain = domain)).body()
}
}
// Where client is created with speci
今天我刚刚更新了我的Android Studio
Android Studio 3.5.2
Build #AI-191.8026.42.35.5977832, built on October 31, 2019
JRE: 1.8.0_202-release-1483-b49-5587405 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.1
我更新了Android Studio,因为当kotlin版本低于1.3.60时,它会向我提示错误。
然而,我遇到了单元测试文件的问题。以前,我可以毫无问题地运行单元测试
嘿我在Ktor工作。我发现这个可以在特定的平台iOS和Android中显示日志。但是,当我通过gradle构建这个命令时,在终端上运行这个命令时会出现错误。正常构建是成功的,没有任何错误,但是当我使用下面的命令时会出现错误。
./gradlew build --warning-mode all
误差
* What went wrong:
Could not determine the dependencies of task ':kotlinmultiplatformsharedmodule:compileIosMainKotlinMetadata'.
> Could
我试图将kmm共享模块添加到我的ios/android应用程序中,但是,我从Xcode运行中获得了这条消息
显示最近的消息:配置项目':shared‘时出现了问题。
> Could not identify build type for Kotlin framework 'shared' built via cocoapods plugin with CONFIGURATION=Staging.
Add xcodeConfigurationToNativeBuildType["Staging"]=NativeBuildType.DEBUG o
我正准备在Google商店发布我的应用程序,并想在生成签名APK之后做最后一次检查。但是,我得到了以下错误。
有解决办法吗?
org.gradle.api.tasks.TaskExecutionException: Execution failed for task
':android:packageRelease'.
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExec
我无法连接到Google并不断地获取此错误:
Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
Ensure that the following correspond to what is in the API Console: Package Name:, API Key: AIzasDDWrwnmz8QWHp-O9ywE7uavUOF7Yrk0SJM, Certifica