Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the test apk located in Android Project?

For running tests, Android Studio/Gradle generates a test apk which performs tests on the app apk. Can anyone share where the test apk gets generated and the location inside the project?

Following is my 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'
}
like image 745
ARK Avatar asked Apr 28 '17 01:04

ARK


People also ask

Where is signed APK located?

Once the APK file build is complete, you'll receive a notification on the bottom right corner of your screen. Select Locate and you will find the APK file location. The Signed APK file is by default named app-release. apk.

How do I inspect an APK file?

Drag an APK or app bundle into the Editor window of Android Studio. Switch to the Project perspective in the Project window and then double-click the APK in the default build/output/apks/ directory. Select Build > Analyze APK in the menu bar and then select your APK or app bundle.


1 Answers

The test apk is generated in rootProject/app/build/outputs/apk/ folder. But to generate the test.apk file, you have to add instrumented tests in src/androidTest folder, atleast one dummy test. Then run the tests on a device by right clicking in project explorer and then select "Run All Tests" or "Run Tests" -->

enter image description here

Once you run the tests, then and then only a test.apk file gets created in the above mentioned folder.

like image 71
ARK Avatar answered Sep 20 '22 23:09

ARK