Nick Thoma Nick Thoma - 1 year ago 236
Android Question

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

Everytime I try to run my tests the console says this:

Running tests
Test running startedTest running failed: Unable to find instrumentation info for:
Empty test suite.

I've been stuck on this for a while and the solutions I've seen online so far have not helped.
My project structure is set up like this:

*Main Module

My build.gradle file looks like this:

buildscript {
repositories {
dependencies {
classpath ''
apply plugin: 'android'

repositories {

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"

defaultConfig {
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "2.1.0"
testPackageName "login.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.txt'

packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/')
compile project(':pullToRefresh')
compile ''
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1+'
compile ''
compile 'org.json:json:20090211'
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.3.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.3.1'
compile ''
compile 'com.mcxiaoke.volley:library:1.0.+@aar'
androidTestCompile 'junit:junit:3.8'

Do you need to have a separate manifest for your tests directory? If so what would that look like?

Edit: I tried adding a manifest to my instrumentTest directory with no luck. Note that I could not get IntelliJ to resolve the targetPackage name, so it appears red.

<manifest xmlns:android=""
<uses-library android:name="android.test.runner" />

Answer Source

So the main problem was that when I created an androidTest folder under /src/, it wasn't being picked up by IntelliJ as a source folder for testing (java subdirectory should turn green). I was using IntelliJ 13.0.3 and after upgrading to 13.1.3, all of my troubles went away.

*Note: do not try to add a manifest to your androidTest folder, the Gradle docs specifically state that the manifest should be auto-generated when you create the androidTest folder. The problem for me was that the file wasn't being generated as androidTest wasn't being recognized by IntelliJ/Gradle, thus throwing the no instrumentation error.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download