After searching 2 days on the internet I wasn't able to find a way to rename the output file name of android-test.apk (for instrumented tests). I am building debug and instrumented tests apk with assembleAndroidTest and assembleDebug.
For debug build I managed to change the name and add version, but I couldn't do it for androidTest.apk. How can I add the same version and other name for test apk? Here is my build.gradle (module)
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
project.archivesBaseName = "Automator"
defaultConfig {
applicationId "com.xxx.automator"
minSdkVersion 18
targetSdkVersion 29
versionCode 1
versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
android.applicationVariants.all { variant ->
variant.outputs.all {
def appName = "Automator"
outputFileName = appName + "-${variant.versionName}.apk"
}
}
}
}
}