Android Test Module (Gradle Plugin 1.3) doesn't work: “debug-classes not found”

半腔热情 提交于 2019-11-28 05:52:18

I was also curious about separating app code and test code and i had hard time to figure it out. I look at the stack trace and found the DependencyManager (line 238) having a TODO to fix that in gradle.

1) You are right about the build flavors.You have to enter the correct variant

targetVariant '<flavor>Debug'

e.g.

targetVariant 'flavor1Debug'

2) You also need to change you targetProjectPath's module build.gradle. Add the following snippet:

android {

    // ...

    publishNonDefault true

    // ...

}

which publishes all build variants! It its disabled by default due to some limitations of gradle.

Here is a sample app that works https://github.com/googlesamples/android-testing-templates/tree/master/AndroidTestingBlueprint

You must use

buildToolsVersion = '23.0.0rc3'

And of course

publishNonDefault true
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!