Update Android Library Module Builds to work without APKs

Description of the feature request

Android Libraries do not produce APKs. But the Android Build for UI Testing step requires an APK to work, otherwise the build fails. In order for the build to pass, the current workaround is to send an empty APK manually, which is not the most elegant solution.

The request to solve this by either:

  • Allow the step to work without APKs
  • Send a dummy APK in case no APKs are found

Use case / for what or how I would use it

Creating Android Library Module Builds

I’m also seeing

virtual-device-testing-for-android                                       |
| version: 1.1.5                
Failed to parse config:
- AppPath: required variable is not present
  • What does the current workaround look like for this?
  • How do you generate this dummy-apk?

My previous steps looks like this:

    - gradle-runner@2:
        title: Assemble test-apk
        inputs:
        - gradle_task: 'assembleDebug :moduleName:assembleFlavor1MockDebugAndroidTest '

Which only sets $BITRISE_TEST_APK_PATH

@Roland-Bak
The reason I need this is that the Ubuntu-16.04 stack is discontinued and my current workaround does not work on the Ubuntu-20.04 stack anymore:


echo "Creating emulator ... "
cd $ANDROID_HOME/emulator
echo no | avdmanager create avd -n Pixel_2_API_26 -k "system-images;android-26;google_apis;x86" --force

echo "Starting emulator ..."
emulator -avd Pixel_2_API_26 -no-window -no-audio -debug-init > /dev/null 2>&1 &

echo "Waiting for emulator to be ready ..."
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'

Hello @armin-schnabel :wave:

Can you please send us the log file or the URL of the related build and also enable Support Access on the Settings tab of the app ( Enabling the Bitrise Support user for your app | Bitrise DevCenter ) so that we can take a more in-depth look?
I’ll forward it to the experts to see what we can do to make your workflow work! :slight_smile:

Hi @Roland-Bak
I enabled support access. There are two build URLs:

This one shows my last failed attempt to create this “current workaround is to send an empty APK manually” you are mentioning above.

And this one shows the workaround which we were using before Ubuntu 16.04 was removed and shows that that workaround is not working with Ubuntu 20.04 anymore.

Cheers!

If someone else ends up here and is wondering what this mysterious “workaround” is:

  • As mentioned here you just use ANY random apk there.
  • A small sample apk would be e.g. this.

To safe you some time, here the workflow:

    - gradle-runner@2:
        title: Assemble module instrumentation test apk
        inputs:
        - gradle_options: "--no-daemon --stacktrace"
        - gradle_task: ":moduleName:assembleDebugAndroidTest "
    - script@1:
        inputs:
        - content: |-
            #!/usr/bin/env bash
            set -e
            set -x
            wget https://some_place_you_uploaded_the_apk_to.apk -O $BITRISE_DEPLOY_DIR/dummy.apk

            envman add --key BITRISE_APK_PATH --value "$BITRISE_DEPLOY_DIR/dummy.apk"
        title: 'workaround: dummy APK'
    - virtual-device-testing-for-android@1:
        inputs:
        - test_type: instrumentation
        - test_devices: Pixel2,29,en,portrait