Test running failed: Unable to find instrumentation info for: ComponentInfo{} -- error trying to test in IntelliJ with Gradle Test running failed: Unable to find instrumentation info for: ComponentInfo{} -- error trying to test in IntelliJ with Gradle android android

Test running failed: Unable to find instrumentation info for: ComponentInfo{} -- error trying to test in IntelliJ with Gradle


I had the same error when I tried adding multiDexEnabled true to build.gradle.

I'm adding my experience here, because this is one of the first Google hits when searching with the ... Unable to find ... ComponentInfo ... error message.

In my case adding testInstrumentationRunner like here did the trick:

...android {    ...    defaultConfig {        ...        testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"    }}

(I have com.android.tools.build:gradle:1.5.0)


I am using Android Studio 1.1 and the following steps solved this issue for me:

  1. In Run - Edit Configurations - Android Tests
    Specify instrumentation runner as android.test.InstrumentationTestRunner

  2. Then in the "Build variants" tool window (on the left), change the test artifact to Android Instrumentation Tests.

No testInstrumentationRunner required in build.gradle and no instrumentation tag required in manifest file.


When I created a new package, Studio created an ApplicationTest class. Using us.myname.mypackage as an example, the following directory structure was created:

app/[myPackage]/src/androidTest/java/us/myname/mypackage/ApplicationTest.class

Initially it worked out of the box. It quit working after I installed product flavors. I subsequently made the following changes to build.gradle:

defaultConfig {   ...   testInstrumentationRunner "android.test.InstrumentationTestRunner"}

some prefer

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

(With my current configuration, I have to use ...InstrumentationTestRunner when in debug, and AndroidJUnitRunner while using release build type.)

The above configuration only works with the debug build type. If you wish to use it with release or with a custom build type, you can include the following in build.gradle:

buildTypes {     release {         ...     } debug {     ... }}testBuildType "release"

In the Build Variants tab on the lower left side of Studio, make sure you have Android Instrumentation Tests and the correct buildType selected.