Development issue/problem:
I tried the suggestions in this post, but I still made a mistake:
! !! JUnit Version 3.8 or higher :
java.lang.RuntimeException : Stub.
on junit.runner.baseTestRunner (BaseTestRunner.java:5)
on junit.textui.TestRunner.java:54
on junit.textui.TestRunner.java:48)
on junit.textui.TestRunner.java:41)
Process interrupted with output code -3
I don’t know what to do from here. Attempts to reorganize the order of subordinates. Bad luck. Anyone else have this problem?
Android Studio V. 1.2.1.1.
How can I solve this problem?
Solution 1:
The problem is solved. I performed the JUnit tests as a standard JUnit test in Android Studio. I solved the problem by resetting the configuration as an Android test.
Solution 2:
Just to add another situation. I get this error after updating Android Studio to 4.1 on a project with the old AGP (3.3.2) and Gradle (4.10.2). I finally solved the problem by removing the android.test.runner library from the Gradle dependencies, i.e. by removing the following line from the build.gradle application module :
useLibrary ‘android.test.runner’ (user library)
I think I was lucky, because I didn’t need any of the courses that the library offers for unit or instrumental tests.
Solution 3:
I solve this problem by moving the test build junit:junit:4.12 to the build.gradle dependency block in the first order.
Solution 4:
You can find out by opening an old project in the latest version of Android Studio 2.3 after the automatic update.
Android Studio supports Android JUnit testing, which should be performed with the current JRE host and JUnit 4+ properly support. The error is due to the incorrect use of JRE.
Solved with Edit Configuration > Select Android JUnit Configuration > Edit JRE. Choose any option, use the Apply option and then return to the default option (Android platform) to make it work.
Solution No 5:
If you have updated your Android Studio version to 4.1 with the latest Gradpligin. Please comment
// useLibrary ‘android.test.runner’
Fixes the error for you.
Solution No 6:
The next solution concerns the work and repetitive tasks you have to perform for each new class you create. I used Gradle for my project on Android Studio.
Step one:
Go to the Run -> Edit Settings
option.
Step two:
For each JUnit test configuration the following fields shall be modified and added:
(a) JRE : The default option is selected. Upgrade to the version of JRE you have on your computer, which you get as an option in the drop-down list. To date it is 1.8
b) Before the beginning of the field : Click +, select your module and add the work as a pure compilerTestJava compiler. Move it to the top of the
JUnit test configuration list.
Step three: Apply the changes and organize the Yava courses now.
Solution No 7:
Apparently this is a studio version of Android 4.1. There is already an open ticket for this subject: https://issuetracker.google.com/issues/170328018.
What really solved the problem for me is the reinstallation of the Android 11 SDK (API 30) as described in the bugticket above:
…there was a problem with the fake API 30 jar that wasn’t properly built
. Can you open Android Studio SDK Manager and try to uninstall
R SDK or any other Android SDK 30 platform? Version
Gradle is installed automatically when you try to rebuild after uninstalling R-SDK version
.
Solution No 8:
I had the same error and I fixed it by the JRE value in Edit Configurations….. in Android Studio, I used API 28 and then it worked. Check the image…
Solution No 9:
In my case, I had simply forgotten that I had changed the construction version. The debugging process has taken care of everything. FML.
Solution No 10:
Running an Android JUNit configuration and having JUnit 4.12 in the graduation class did not help to solve this problem.
I had to manually select the JRE for the PI 27 platform instead of Standard in the running configuration file to solve the problem.
Good luck!
Related Tags:
intellij junit nosuchmethoderror,intellij junit not found in module,java.lang.runtimeexception: stub!,junit jar,package org junit does not exist intellij,junit 5 junit version 3.8 or later expected,update junit version android studio,test framework quit unexpectedly junit version 3.8 or later expected,junit for android,how to run junit in android studio,error: package junit framework does not exist android studio,unit testing android studio,android unit test activity