https://kotlinlang.org logo
Title
c

Carrascado

07/27/2020, 5:24 PM
In fact that 4.1.3 version gives me problems with the Kotest plugin
s

sam

07/27/2020, 5:32 PM
Can you show me the errors? Or create an issue with the stack traces?
c

Carrascado

07/27/2020, 5:36 PM
Of course, but I still wonder why this 4.1.3 version only exists for me and my Gradle but the Github repository acts as If it never existed.
Exception in thread "main" java.lang.NoClassDefFoundError: io/github/classgraph/ClassGraph
	at io.kotest.core.config.DetectConfigKt.detectConfig(detectConfig.kt:61)
	at io.kotest.core.config.Project.<clinit>(Project.kt:45)
	at io.kotest.core.engine.KotestEngine.<init>(KotestEngine.kt:53)
	at io.kotest.core.engine.KotestEngineLauncher.launch(KotestEngineLauncher.kt:35)
	at io.kotest.runner.console.KotestConsoleRunner.execute(KotestConsoleRunner.kt:22)
	at io.kotest.runner.console.Execute.run(launcher.kt:66)
	at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:154)
	at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:14)
	at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:252)
	at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:249)
	at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:267)
	at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:290)
	at io.kotest.runner.console.LauncherKt.main(launcher.kt:14)
Caused by: java.lang.ClassNotFoundException: io.github.classgraph.ClassGraph
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	... 13 more

Process finished with exit code 1
This is all the relevant stuff I'm loading in Gradle about this:
testImplementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.72'
    testImplementation 'io.kotest:kotest-runner-junit5-jvm:4.1.3'
    testImplementation 'io.kotest:kotest-assertions-core-jvm:4.1.3'
    testImplementation 'io.kotest:kotest-runner-console-jvm:4.1.3'
    testImplementation 'io.kotest:kotest-property-jvm:4.1.3'
if I use 4.1.2 I also get errors:
Exception in thread "main" java.lang.ClassNotFoundException: com.carrascado.pruebaskotest.ExampleKotest
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at io.kotest.runner.console.KotestConsoleRunner.execute(KotestConsoleRunner.kt:27)
	at io.kotest.runner.console.Execute$run$1.invokeSuspend(launcher.kt:67)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:79)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54)
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36)
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
	at io.kotest.runner.console.Execute.run(launcher.kt:51)
	at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:154)
	at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:14)
	at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:252)
	at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:249)
	at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:267)
	at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:290)
	at io.kotest.runner.console.LauncherKt.main(launcher.kt:15)
s

sam

07/27/2020, 5:44 PM
4.1.3 is on maven central
there's just no link for it under github releases which I don't use that much, and I need to update the changelog
How are you launching the tests - are you trying to run all in a package ?
c

Carrascado

07/27/2020, 5:57 PM
I play that "double play" button in the whole class, just that, they are extremely simple/nonsense tests just for trying kotest
s

sam

07/27/2020, 5:57 PM
If you use the double play, it shouldn't need classgraph at all, so I don't know why you would get that error
c

Carrascado

07/27/2020, 5:58 PM
Anyways If I click the "single play" it gives the same error
This is my whole Gradle file, maybe something is really wrong?
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.carrascado.pruebaskotest"
        minSdkVersion 27
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
        }
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }
}

android.testOptions {
    unitTests.all {
        useJUnitPlatform()
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
    implementation 'androidx.core:core-ktx:1.3.1'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    testImplementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.72'
    testImplementation 'io.kotest:kotest-runner-junit5-jvm:4.1.2'
    testImplementation 'io.kotest:kotest-assertions-core-jvm:4.1.2'
    testImplementation 'io.kotest:kotest-runner-console-jvm:4.1.2'
    testImplementation 'io.kotest:kotest-property-jvm:4.1.2'

//    implementation "io.arrow-kt:arrow-core:0.10.4"
//    implementation "io.arrow-kt:arrow-syntax:0.10.4"
//    kapt    "io.arrow-kt:arrow-meta:0.10.4"
}
s

sam

07/27/2020, 6:00 PM
Android studio ?
c

Carrascado

07/27/2020, 6:01 PM
Yes
Android Studio 4.0.1
And the kotest plugin is 1.0.5
And I'm putting the test class
ExampleKotest
right there, in the unit tests package, I don't know If that may be causing the problem
Might this dependency be causing the problem?
testImplementation 'junit:junit:4.13'
Since it's junit4 but later Kotest runs on JUnit5? (Btw I didn't know Kotest needed Junit to run)
s

sam

07/27/2020, 6:08 PM
I think it's just that android studio does weird things with the classpaths
and that's why you're seeing these errors
you can try the latest plugin if you want but it's not released yet
c

Carrascado

07/27/2020, 6:09 PM
How do I install that zip?
s

sam

07/27/2020, 6:12 PM
settings -> plugins click the cog
c

Carrascado

07/27/2020, 6:13 PM
If I select the .zip directly it says that the plugin is "incompatible with the installation"
s

sam

07/27/2020, 6:14 PM
you must have an old version of studio
c

Carrascado

07/27/2020, 6:15 PM
This is what it finds If I check for updates, may I need any of those things?
s

sam

07/27/2020, 6:16 PM
I don't know, I don't use android studio. The incompatible message is probably because the plugin defines a new version of studio than what you have
the latest is 4.0.1
c

Carrascado

07/27/2020, 6:16 PM
Then that plugin is working with a version that is not a release? Because according to the toolbox I have the last release
s

sam

07/27/2020, 6:16 PM
ok, I will need to check into that
c

Carrascado

07/27/2020, 6:16 PM
That is my version, 4.0.1
s

sam

07/27/2020, 6:16 PM
ok
c

Carrascado

07/27/2020, 6:17 PM
By the way thank you very much for your time and help, I'm starting with Kotlin and I didn't know If I was doing something wrong or I was not setting something up correctly
s

sam

07/27/2020, 6:18 PM
You've done everything right.
🙂 1
I will figure out the version strings needed to make this installable by android studio
👍 1