java.lang.Exception: Custom runner class AndroidJUnit4 should have a public constructor with signature AndroidJUnit4(Class testClass)

前端 未结 5 2051
执念已碎
执念已碎 2021-01-03 21:19

gradle looks like:

apply plugin: \'com.android.application\'

android {
    compileSdkVersion 25
    buildToolsVersion \"25.0.2\"

    defaultConfig {
              


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-03 21:30

    I had the same problem. I'm working in Android studio 2.3.1. I checked my run configurations. Under Run->Edit Configurations and discovered the test I was trying to run as an instrumented test was under the Android JUnit tests category, even though I had it in the androidTest directory in my project. I added an Android Instrumented Test (hit the plus button in the corner) and set it to point to the test I was trying to run. That fixed it for me.

提交回复
热议问题