Android的测试模块(摇篮插件1.3)不工作:"未发现和QUOT调试类; [英] Android Test Module (Gradle Plugin 1.3) doesn't work: "debug-classes not found"

查看:259
本文介绍了Android的测试模块(摇篮插件1.3)不工作:"未发现和QUOT调试类;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Android的工作室博客文章描述建立一个单元测试模块。然而,做一个摇篮构建失败告诉我,配置名称为调试类未找到。调试是targetVariant它试图建立的名字,但我不明白是怎么回事错在这里。

I'm attempting to set up a unit test module as described in the android studio blog post. However, doing a gradle build fails telling me "Configuration with name 'debug-classes' not found". Debug is the name of the targetVariant it's trying to build, but I don't understand what is going wrong here.

下面是我的测试模块的摇篮文件。

Here's my test module's gradle file.

apply plugin: 'com.android.test'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

targetProjectPath ':app'
targetVariant 'debug'
}    

这是描述新的测试模块功能的博文。 <一href="http://android-developers.blogspot.com/2015/07/get-your-hands-on-android-studio-13.html">http://android-developers.blogspot.com/2015/07/get-your-hands-on-android-studio-13.html

This is the blogpost describing the new test module functionality. http://android-developers.blogspot.com/2015/07/get-your-hands-on-android-studio-13.html

我使用的摇篮插件V1.3.0

I'm using the Gradle plugin v1.3.0

推荐答案

我也好奇分离应用程序code和测试code和我有很难弄明白。我看堆栈跟踪,发现<一href="https://android.googlesource.com/platform/tools/base/+/master/build-system/gradle-core/src/main/groovy/com/android/build/gradle/internal/DependencyManager.java">DependencyManager (线238),具有TODO修复在摇篮。

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)你是对的构建flavors.You必须输入正确的变体

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

targetVariant '<flavor>Debug'

例如。

targetVariant 'flavor1Debug'

2)你还需要改变你targetProjectPath的模块build.gradle。添加以下代码段:

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.

这篇关于Android的测试模块(摇篮插件1.3)不工作:&QUOT;未发现和QUOT调试类;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆