allure-framework / allure-kotlin

Allure integrations for test frameworks targeting Kotlin and Java with 1.6 source compatibility.
Apache License 2.0
57 stars 21 forks source link

java.lang.NoSuchMethodError: No direct method <init> #45

Closed imbirovsky closed 3 years ago

imbirovsky commented 3 years ago

When I run the test, I get:

Test failed to run to completion. Reason: 'Test run failed to complete. Expected 1 tests, received 0'. Check device logcat for details
Test running failed: Test run failed to complete. Expected 1 tests, received 0. There was 1 failure:
1) ua.test.appv6.fullTests.tests.ArchiveTests
java.lang.NoSuchMethodError: No direct method <init>(ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V in class Lkotlin/jvm/internal/FunctionReferenceImpl; or its super classes (declaration of 'kotlin.jvm.internal.FunctionReferenceImpl' appears in /data/app/ua.test.app-rNa52u8s63fXK_YUpb6k6Q==/base.apk!classes4.dex)
at io.qameta.allure.kotlin.util.AnnotationUtils$getLabels$1.<init>(Unknown Source:10)
at io.qameta.allure.kotlin.util.AnnotationUtils.getLabels(AnnotationUtils.kt:85)
at io.qameta.allure.kotlin.junit4.AllureJunit4.extractLabels(AllureJunit4.kt:114)
at io.qameta.allure.kotlin.junit4.AllureJunit4.createTestResult(AllureJunit4.kt:159)
at io.qameta.allure.kotlin.junit4.AllureJunit4.testStarted(AllureJunit4.kt:46)
at org.junit.runner.notification.RunNotifier$3.notifyListener(RunNotifier.java:121)
at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java:118)
at org.junit.internal.runners.model.EachTestNotifier.fireTestStarted(EachTestNotifier.java:42)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:323)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

FAILURES!!!
Tests found: 1, Tests run: 1,  Failures: 1

Logcat for details:

E: failed: ua.test.appv6.fullTests.tests.ArchiveTests
E: ----- begin exception -----
E: java.lang.NoSuchMethodError: No direct method <init>(ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V in class Lkotlin/jvm/internal/FunctionReferenceImpl; or its super classes (declaration of 'kotlin.jvm.internal.FunctionReferenceImpl' appears in /data/app/ua.test.app-Odx6Cq3l4mb5QBS1gFGn-A==/base.apk!classes4.dex)
        at io.qameta.allure.kotlin.util.AnnotationUtils$getLabels$1.<init>(Unknown Source:10)
        at io.qameta.allure.kotlin.util.AnnotationUtils.getLabels(AnnotationUtils.kt:85)
        at io.qameta.allure.kotlin.junit4.AllureJunit4.extractLabels(AllureJunit4.kt:114)
        at io.qameta.allure.kotlin.junit4.AllureJunit4.createTestResult(AllureJunit4.kt:159)
        at io.qameta.allure.kotlin.junit4.AllureJunit4.testStarted(AllureJunit4.kt:46)
        at org.junit.runner.notification.RunNotifier$3.notifyListener(RunNotifier.java:121)
        at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
        at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java:118)
        at org.junit.internal.runners.model.EachTestNotifier.fireTestStarted(EachTestNotifier.java:42)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:323)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
        at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2214)
E: ----- end exception -----
testInstrumentationRunner "io.qameta.allure.android.runners.AllureAndroidJUnitRunner"
...
androidTestImplementation "io.qameta.allure:allure-kotlin-commons:$rootProject.properties.allureRunnerVersion"
androidTestImplementation "io.qameta.allure:allure-kotlin-model:$rootProject.properties.allureRunnerVersion"
androidTestImplementation "io.qameta.allure:allure-kotlin-android:$rootProject.properties.allureRunnerVersion"
androidTestImplementation "io.qameta.allure:allure-kotlin-junit4:$rootProject.properties.allureRunnerVersion"
///
kotlin_version = '1.3.72'
...
classpath 'com.android.tools.build:gradle:4.0.1'
...
allureRunnerVersion = '2.2.1'

Unfortunately, we ran out of ideas. I hope for your help. Thank you! The effects of migration on allure-kotlin

dimkinware commented 3 years ago

Have the same problem with 2.2.1 version

viclovsky commented 3 years ago

Starting from 2.2.0 version Allure-kotlin has several dependencies: Kotlin 1.4.21, Kotlin Serialization 1.0.1, Gradle 6.7.1 (https://github.com/allure-framework/allure-kotlin/pull/37). To my mind the problem is related to incompatibility of versions. Please, update the dependencies and try again.

imbirovsky commented 3 years ago

It helped to increase the version of the gradle:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

But the app cant go to such a step yet 😞

I lowered the version of the allure and everything is okay.

@viclovsky, thank you!