title: Robotium in Android Studio with Cucumber
body: <p>I have been trying to integrate Cucumber(java) with Robotium to add BDD to android tests in the Android studio. Unfortunately i am getting stuck trying to run the Cucumber features as it is not able to identify the step definitions.</p>
  <p>My folder structure is as below:</p>
  <h2>ParentProject</h2>
  <pre><code>   |
     Module
        |
        src
          |
           instrumentTest
                  | 
                  java(this is the source root in build.gradle)
                     | 
                     cucumbertests
                          | 
                          CukeRunner.java
                          | 
                          steps
                  |
                  resources
                     |
                     cucumbertests
                           |
                           Sample.feature
  </code></pre>
  <p>The above setup works fine in intellij.</p>
  <p>My build.gradle in the module is as follows:</p>
  <pre><code>    buildscript {
      dependencies {
          repositories {
              mavenCentral()
              mavenLocal()
          }
          classpath 'com.android.tools.build:gradle:0.7.3'
      }
  
  }
  
  apply plugin: 'android'
  
  dependencies {
      repositories {
          mavenCentral()
          mavenLocal()
      }
      compile 'com.nineoldandroids:library:2.4.0'
      compile 'com.android.support:support-v4:19.0.0'
      compile 'com.android.support:appcompat-v7:19.0.0'
      compile 'com.google.android.gms:play-services:4.0.30'
      compile 'com.squareup:otto:1.3.4'
      compile 'com.squareup.dagger:dagger:1.1.0'
      compile 'com.squareup.dagger:dagger-compiler:1.1.0'
      compile 'com.squareup.okhttp:okhttp:1.2.1'
      compile 'com.squareup.retrofit:retrofit:1.2.1'
      compile 'com.google.code.gson:gson:2.2.4'
      compile 'com.google.guava:guava:15.0'
      compile 'com.google.maps.android:android-maps-utils:0.2.1'
      compile 'se.emilsjolander:StickyScrollViewItems:1.1.0'
      compile fileTree(dir: 'libs', include: '*.jar')
  
      instrumentTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'
      instrumentTestCompile 'info.cukes:cucumber-android:1.1.5'
      instrumentTestCompile 'info.cukes:cucumber-junit:1.1.5'
      instrumentTestCompile 'info.cukes:cucumber-picocontainer:1.1.5'
      instrumentTestCompile 'info.cukes:gherkin:2.12.2'
  }
  
  android {
  
      testBuildType &quot;debug&quot;
      compileSdkVersion 19
      buildToolsVersion '19.0.0'
  
      defaultConfig {
          minSdkVersion 9
          targetSdkVersion 19
      }
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_6
          targetCompatibility JavaVersion.VERSION_1_6
      }
  
      signingConfigs {
          debug {
              storeFile file('../certificate/debug.keystore')
          }
      }
  
      sourceSets {
          instrumentTest {
              java.srcDirs = ['src/instrumentTest/java','src/instrumentTest/cucumber']
          }
  
          main {
              manifest.srcFile 'src/main/AndroidManifest.xml'
              java.srcDirs = ['src/main/java', 'AndroidRSS/src']
              resources.srcDirs = ['src/main/res']
              aidl.srcDirs = ['src/main/aidl']
              renderscript.srcDirs = ['src/main/rs']
              res.srcDirs = ['src/main/res']
              assets.srcDirs = ['src/main/assets']
          }
      }
  }
  </code></pre>
  <p>Error i get is that Cucumber hasnt been able to detect the step definitions. Since this structure works in intellij i think it may just be different way to be able to have this working in Android studio.</p>
  <p>I am trying to have a test work like this <a href="https://stackoverflow.com/a/19940625/1165859">https://stackoverflow.com/a/19940625/1165859</a></p>
  <p>My feature file is :</p>
  <p><img src="https://i.stack.imgur.com/NzKgO.png" alt="enter image description here" /></p>
  <p>The Feature file run config is :</p>
  <p><img src="https://i.stack.imgur.com/xo91B.png" alt="enter image description here" /></p>
  <p>The cukerunner is</p>
  <pre><code>    package cucumbertests;
  
  import org.junit.runner.RunWith;
  
  import cucumber.api.junit.Cucumber;
  
  
  
  @RunWith(Cucumber.class)
  @Cucumber.Options()
  public class cukerunner {
  }
  </code></pre>
  <p>Run results i get are:</p>
  <p><img src="https://i.stack.imgur.com/2OKcK.png" alt="enter image description here" /></p>
  <p>Inspite of these methods implemented in the cucumbertests.steps</p>