我正在尝试将Espresso测试添加到一个发布版APK中。在我们的情况下,我们必须对实际发布内容进行测试,因此UI测试必须包含在发布版中。
所以我的主要问题是:如何最好地完成此操作?目前在互联网上的研究没有给我任何结果。
我已经尝试将构建脚本中的androidDebugTest更改为编译(compile)。
我收到了这个错误信息:
此外,通常有两个gradle任务
提前感谢您的建议!
所以我的主要问题是:如何最好地完成此操作?目前在互联网上的研究没有给我任何结果。
我已经尝试将构建脚本中的androidDebugTest更改为编译(compile)。
compile 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
并且,这里也有:
compile 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
但是在调用之后
./gradlew assembleRelease --info --debug
我收到了这个错误信息:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/annotation/Generated.class
...
BUILD FAILED
此外,通常有两个gradle任务
assembleDebug
和assembleDebugAndroidTest
与Espresso一起使用。但是对于发布版本构建,因为没有assembleReleaseAndroidTest
任务,该怎么办呢?提前感谢您的建议!