在android studio中,当我运行espresso测试时,控制台输出:

Installing APK: /home/roroco/Dropbox/jvs/ro-adr/testStartApp/build/outputs/apk/testStartApp-debug-androidTest-unaligned.apk
Uploading file to: /data/local/tmp/ro.testStartApp.test
Installing ro.testStartApp.test
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/ro.testStartApp.test"
    pkg: /data/local/tmp/ro.testStartApp.test
Success


但是当我rm build /并运行gradle assembleDebug时,“ testStartApp-debug-androidTest-unaligned.apk”不存在,如下所示:

roroco@roroco ~/Dropbox/jvs/ro-adr/testStartApp $ lsa /home/roroco/Dropbox/jvs/ro-adr/testStartApp/build/outputs/apk
total 9496
drwxr-xr-x 2 roroco roroco    4096 May 21 23:08 .
drwxr-xr-x 6 roroco roroco    4096 May 21 23:40 ..
-rw-r--r-- 1 roroco roroco 3237948 May 21 23:08 testStartApp-debug.apk
-rw-r--r-- 1 roroco roroco 3237559 May 21 23:08 testStartApp-debug-unaligned.apk
-rw-r--r-- 1 roroco roroco 3211410 May 21 23:08 testStartApp-release-unsigned.apk


哪个gradle任务可以生成“ testStartApp-debug-androidTest-unaligned.apk”?

最佳答案

当我列出任务时:

roroco@roroco ~/Dropbox/jvs/ro-adr/testStartApp $ gd tasks|gr assemble
assemble - Assembles all variants of all applications and secondary packages.
assembleAndroidTest - Assembles all the Test applications.
assembleDebug - Assembles all Debug builds.
assembleRelease - Assembles all Release builds.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.
Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration.


它是组装AndroidTest

关于android - 如何在gradle任务中构建-debug-androidTest-unaligned.apk,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37364988/

10-10 06:18