android - 如何在 gradle 任务中构建 -debug-androidTest-unaligned.apk

标签 android android-espresso

在 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.

它是 assembleAndroidTest

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

相关文章:

android - 在执行测试之前,如何要求gradlew卸载应用程序?

Android:如何使用 ConstraintLayout 在另一个小部件上显示一个小部件?

android - toast : Internal Error Occur with integration of Google Plus in Android

java - 如何在 Android Espresso 中的 View 之间导航

android - 在为 Android 进行 Espresso 功能测试时让 Dagger 注入(inject)模拟对象

java - 用于 Espresso 测试的 Android Studio 项目设置

java - 如何使用 Google Fit API 按需获取 SmartBand2 的实时心率?

java - 使用 Intent 启动 Activity 时遇到问题

java - Stackoverflow EditText 小部件

Android Espresso 黑盒测试