Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'

后端 未结 7 1021
攒了一身酷
攒了一身酷 2021-01-03 20:33

This is my first time setting up an Android test project to test a Android project.

I\'ve created a very basic test case which I\'m trying to get to run, however wh

7条回答
  •  长情又很酷
    2021-01-03 21:00

    I had this problem after a merge, in which build.gradle was specifying the wrong test package, since I had been using the default.

    By simply removing these lines from build.gradle, it was able to find the necessary classes in the default package, which is src/androidTest.

    sourceSets {
        instrumentTest.setRoot('src/instrumentTest')
    }
    //removed this to use the default androidTest source set.
    

    This will probably not be the exact solution, but hopefully guides someone in the right direction.

提交回复
热议问题