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

Raj*_*Raj 3 android android-testing

对于正在运行的测试,Android Studio / Gradle会生成一个测试apk,该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'
}
Run Code Online (Sandbox Code Playgroud)

Raj*_*Raj 5

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

在此处输入图片说明

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


Kho*_*han 5

对于 Kotlin 项目,它可能位于: <yourproject>/app/build/intermediates/apk/androidTest/debug


Aru*_*ava 1

/YourProject/app/build/outputs/apk