title: ANT Android project to Android Studio
body: <p>I have a fully working Android application based on <strong>ANT</strong> build tools. It is used with <strong>Eclipse</strong> but I have to make it work with <strong>Android Studio</strong> as well. I managed to export the project with <strong>ADT Gradle Export Tool</strong> and the application itself works great. However, I can't get the test project to work.</p>
  
  <p>Here's <code>build.gradle</code> generated by <strong>Eclipse ADT</strong> plugin.</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.8.+'
      }
  }
  apply plugin: 'android'
  
  dependencies {
      compile fileTree(dir: 'libs', include: '*.jar')
  }
  
  android {
      compileSdkVersion 19
      buildToolsVersion "19.0.1"
  
      sourceSets {
          main {
              manifest.srcFile 'AndroidManifest.xml'
              java.srcDirs = ['src']
              resources.srcDirs = ['src']
              aidl.srcDirs = ['src']
              renderscript.srcDirs = ['src']
              res.srcDirs = ['res']
              assets.srcDirs = ['assets']
          }
  
          // Move the tests to tests/java, tests/res, etc...
          instrumentTest.setRoot('tests')
  
          // Move the build types to build-types/&lt;type&gt;
          // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
          // This moves them out of them default location under src/&lt;type&gt;/... which would
          // conflict with src/ being used by the main source set.
          // Adding new build types or product flavors should be accompanied
          // by a similar customization.
          debug.setRoot('build-types/debug')
          release.setRoot('build-types/release')
      }
  }
  </code></pre>
  
  <p>My project structure</p>
  
  <pre><code>.
  ├── AndroidManifest.xml
  ├── ant.properties
  ├── build.gradle
  ├── build.xml
  ├── gradle
  │   └── wrapper
  │       ├── gradle-wrapper.jar
  │       └── gradle-wrapper.properties
  ├── gradlew
  ├── gradlew.bat
  ├── LICENSE
  ├── local.properties
  ├── MyApp.iml
  ├── proguard-project.txt
  ├── project.properties
  ├── README.md
  ├── res
  │   ├── drawable-hdpi
  │   │   └── ic_launcher.png
  │   ├── drawable-ldpi
  │   │   └── ic_launcher.png
  │   ├── drawable-mdpi
  │   │   └── ic_launcher.png
  │   ├── drawable-xhdpi
  │   │   └── ic_launcher.png
  │   ├── layout
  │   │   └── main.xml
  │   └── values
  │       └── strings.xml
  ├── src
  │   └── com
  │       └── example
  │           └── myapp
  │               └── MainActivity.java
  └── tests
      ├── AndroidManifest.xml
      ├── ant.properties
      ├── build.xml
      ├── proguard-project.txt
      ├── project.properties
      └── src
          └── com
              └── example
                  └── myapp
                      └── MainActivityTest.java
  </code></pre>
  
  <p>For me it seems that <strong>Android Studio</strong> is not able to detect <code>tests/src/PACKAGE</code> as a package. It is classified as casual directories instead.</p>
  
  <p>I would really appreciate any hints.</p>
  
  <p>EDIT:
  If <code>tests/src</code> is renamed into <code>tests/java</code> everything works. But this is not a solution since tests will stop working with <strong>ANT</strong> and/or <strong>Eclipse</strong>.</p>