I use ./gradlew assembleAndroidTest
to create app-debug-androidTest.apk
, but the versionCode for apk is always 0
. Is there any to set the versionCode for app-debug-androidTest.apk
.
Thanks!
For normal apk, I can set in AndroidManifest.xml
:
android:versionCode="110"
android:versionName="3.0.17 alpha"
or in build.gralde
:
defaultConfig {
applicationId "com.android.searchui"
minSdkVersion 18
targetSdkVersion 22
versionCode 84
versionName "9.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
But when during instrumented tests, there are generated two .apk files. And the smaller one is app-debug-androidTest-unaligned.apk and it's versionCode is 0.
Updated on 2017/8/4:
I think it's very difficult to do this because the com.android.application
gradle plugin didn't provider androidTest apk versionCode setting.
So I just put a version.xml
to src/androidTest/res/values
folder:
<resources>
<integer name="versionCode">111</integer>
</resources>
Use this to fake versionCode.