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

AllureAndroidJUnitRunner IllegalStateException: No instrumentation registered! Must run under a registering instrumentation. #67

Closed JacobKant closed 2 years ago

JacobKant commented 2 years ago

What is the current behavior?

only Allure version 2.3.0 When running any test in the sample repository project on a device with more than 27 api, I get an error for example io.qameta.allure.sample.junit4.android.SampleActivitySuccessTest

stacktrace in logcat - Process: io.qameta.allure.sample.junit4.android, PID: 24780 java.lang.RuntimeException: Exception thrown in onCreate() of ComponentInfo{io.qameta.allure.sample.junit4.android.test/io.qameta.allure.android.runners.AllureAndroidJUnitRunner}: java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation. at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6709) at android.app.ActivityThread.access$1300(ActivityThread.java:237) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation. at androidx.test.platform.app.InstrumentationRegistry.getInstrumentation(InstrumentationRegistry.java:45) at io.qameta.allure.android.AllureAndroidLifecycleKt.obtainResultsDirectory(AllureAndroidLifecycle.kt:17) at io.qameta.allure.android.AllureAndroidLifecycleKt.access$obtainResultsDirectory(AllureAndroidLifecycle.kt:1) at io.qameta.allure.android.AllureAndroidLifecycle.(AllureAndroidLifecycle.kt:9) at io.qameta.allure.android.runners.AllureAndroidJUnitRunner.onCreate(AllureAndroidJUnitRunners.kt:74) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6704) at android.app.ActivityThread.access$1300(ActivityThread.java:237)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:223)  at android.app.ActivityThread.main(ActivityThread.java:7656)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 

apetrov322 commented 2 years ago

Have the same error with any API version (from the api 25 )

Mortalite commented 2 years ago

Do you able to run 2.2.7 version on API greater than 28? (28 API and below working well on our project) I have error: adb: error: failed to stat remote object '/sdcard/allure-results': No such file or directory

If bump to 2.3.0 then tests just finished in 0 second, like they all completely dissapeared(any API).

Can't even imagine what went wrong.

UPD: Added android:requestLegacyExternalStorage="true"