4

The release notes from Android 1.3 state that it's now possible to have application tests under a separate module (source: http://android-developers.blogspot.ro/2015/07/get-your-hands-on-android-studio-13.html)

For more flexibility in app testing, you now have the option to place your code tests in a separate module and use the new test plugin (‘com.android.test’) instead of keeping your tests right next to your app code. This feature does require your app project to use the Gradle Plugin 1.3

However, I haven't seen any option in AS to create such module and when I try to create one myself (first create Java library module, then alter its build.gradle file), like:

apply plugin: 'com.android.test'

android {

    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    targetProjectPath ':app'
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

I'm getting an error:

Error:Configuration with name 'debug-classes' not found.

Has anyone managed to get this working?

P. S. I'm using AS 1.3 with Android Gradle plugin v1.3.

marius bardan
  • 4,962
  • 4
  • 29
  • 32
  • I do not like this. This reminds me of the old school Eclipse "2 separate" projects for testing. – Jared Burrows Aug 04 '15 at 18:36
  • 1
    Me neither. However, it's better than constantly switching the build variants between Unit Tests and Instrumentation tests. Plus, 3rd party libs, like Dagger2, have issues generating code under the current 'test' folder. – marius bardan Aug 04 '15 at 18:42
  • That's a good idea. Are you going to have / and /? My gradle setup is for multi project so I have / and / etc. I guess I can try this configuration out. – Jared Burrows Aug 04 '15 at 18:45
  • Yes, that's how I understand it as well. However, I'm not sure if it supports only Instrumentation Tests or Unit Tests as well. Let me know if you also have this error. – marius bardan Aug 04 '15 at 18:46

0 Answers0