Android Studio import existing unit tests “Unable to find instrumentation info”

前端 未结 15 1827
故里飘歌
故里飘歌 2021-02-01 12:17

So I\'m trying our Android Studio and testing a project that worked in eclipse. I got everything compiling and the application will launch just fine, but I can\'t get my unit te

相关标签:
15条回答
  • 2021-02-01 13:07

    For me the problem was having this dependency:

    debugCompile 'com.android.support.test:rules:0.2'
    

    After I removed it my tests were found and run again.

    Note that I didn't get the "Unable to find instrumentation" message but a "No tests found" message.

    0 讨论(0)
  • 2021-02-01 13:08

    I've got same problem as @Iuliia Ashomok and tried everything on the internet.

    Still no luck.

    After 2 days investigation, I found that the problem is created by the mobile phone. .V.

    I originally use Xiaomi Mi4i as testing device(rooted) and tests could not be run. Of course, I got the error below.

    Test running failed: Unable to find instrumentation info for: ComponentInfo{<packagename>/android.test.InstrumentationTestRunner}
    

    However, when I use Sony Xperia Z3(No root), everything works well.

    0 讨论(0)
  • 2021-02-01 13:08

    I once got this error. I use the sdk tools in CLI mode. And the error happened when i launch 'ant test' in the test project. I later notice that I didn't even build and install the test project before ! (with 'ant debug install') So you should have try to check your running configuration to see if the test project got effectively build before running the test. For the other case, Android Studio use Gradle. I don't know it well but try to check the Gradle settings for the project or the Gradle settings file.

    0 讨论(0)
提交回复
热议问题