And*_*san 2 testing instrumentation android build gradle
在互联网上搜索了两天后,我无法找到重命名 android-test.apk 的输出文件名(用于仪器测试)的方法。我正在使用 assembleAndroidTest 和 assembleDebug 构建调试和仪器测试 apk。
对于调试构建,我设法更改名称并添加版本,但无法对 androidTest.apk 执行此操作。如何为测试 apk 添加相同版本和其他名称?这是我的 build.gradle (模块)
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"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
小智 6
将此代码添加到您的应用程序中build.gradle:
android {
// Make custom APK name for test builds
testVariants.all { testVariant ->
testVariant.outputs.all { output ->
outputFileName = "CustomNameTest.apk"
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1098 次 |
| 最近记录: |