android - Android 项目中的测试 apk 在哪里?

标签 android android-testing

为了运行测试,Android Studio/Gradle 生成一个测试 apk,它对应用程序 apk 执行测试。任何人都可以分享生成测试 apk 的位置以及项目中的位置吗?

下面是我的app/build.gradle

apply plugin: 'com.android.application'

android {
   compileSdkVersion 25
   buildToolsVersion "25.0.2"
   defaultConfig {
      applicationId "com.ark.beacons_test"
      minSdkVersion 16
      targetSdkVersion 25
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
   }
   buildTypes {
      release {
         minifyEnabled false
         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
   }

   packagingOptions {
      exclude 'META-INF/LICENSE'
   }

}

dependencies {
   compile fileTree(include: ['*.jar,*.aar'], dir: 'libs')
   compile(name: 'android-lib', ext: 'aar')
   compile 'com.android.support:appcompat-v7:25.3.1'
   compile 'com.android.support.constraint:constraint-layout:1.0.2' 
   androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
   })
   testCompile 'junit:junit:4.12'
}

最佳答案

测试apk生成在rootProject/app/build/outputs/apk/文件夹中。但是要生成 test.apk 文件,您必须在 src/androidTest 文件夹中添加插桩测试,至少一个虚拟测试。然后通过右键单击项目资源管理器在设备上运行测试,然后选择“运行所有测试”或“运行测试”-->

enter image description here

运行测试后,将在上述文件夹中仅创建一个 test.apk 文件。

关于android - Android 项目中的测试 apk 在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43670463/

相关文章:

android - onChildView 和 hasSiblings 与 Espresso

android - Android uiautomator如何在EditText中填写密码?

android - 在 AVD 模拟器上运行 Gradle connectedCheck 时出现 NoClassDefFoundError

android - Instrumentation.invokeMenuActionSync() 不适用于旧版 Android 设备 (API10)

android - 将自定义字体应用于带有节标题的 ListView

接口(interface)中的 Java 保护方法?

Android 测试 - Android performClick() 或 Robotium clickOnView() 都不起作用

android - 无法获得提供者 - 很少在 kitkat 上崩溃

java - Android MPChart 重置scrollingX

android - 需要在android中使用GPS跟踪位置