I am trying to build an initial apk for a test suite that we intend to use for our Clover Payment Device development. Part of the requirements for this upload is a v1 signed apk (solved) with a versionCode (unsolved). For some reason, I can't compile a test apk that has a versionCode built into it.
I am building the apk with gradlew assembleAndroidTest
I am validating the apk with aapt dump badging <path to apk>
Here is the relevant snippet from my gradle file:
    defaultConfig {
        minSdkVersion 17
        //noinspection ExpiredTargetSdkVersion
        targetSdkVersion 25
        versionCode 11 //project.bambooVersion.toInteger()
        versionName "1.0.1" //project.bambooVersionCode
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        buildConfigField("String", "PROTO_VERSION", '"' + versions.ethorProto + '"')
        buildConfigField("String", "CLOVER_SDK", '"' + clover_sdk + '"')
        buildConfigField("String", "VERSION_NAME", '"' + bambooVersionCode + '"')
    }
    signingConfigs {
        if (rootProject.file('key.properties').exists()) {
            debug {
                def keystorePropertiesFile = rootProject.file("key.properties")
                def keystoreProperties = new Properties()
                keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
                enableV1Signing true
                enableV2Signing false
            }
        }
    }
I was very hopeful with this solution: AndroidManifest in androidTest directory being ignored but making a separate "debug" manifest hasn't resolved the issue.
Any insight into this would be greatly appreciated.
                        
Posting a "work-around" instead of an actual solution-- i.e. this works but it's ugly and it's not something I'd want to do on a routine basis.
gradlew assembleAndroidTestapktool d <apkfile>android:versionCodeandandroid:versionNamedataapktool b <decoded apk directory>zipalign -p -f -v 4 <source-apk> <dest-apk>apksigner.bat sign --ks <keystore_file> --v1-signing-enabled=true --v2-signing-enabled=false --v3-signing-enabled=false --v4-signing-enabled=false --in <dest-apk>