Gradle Runner + how to specify the signed apk?


Bitrise Build Issue Report template

Description of the issue

Hi, after the Android Sign Step, I put the Gradle Runner and configured it to run the ‘appDistributionUploadRelease’ task from the Firebase Distribution plugin.

Unfortunately the gradle task gets the wrong apk (unsigned), this is the logs:

Task :app:appDistributionUploadRelease
Using APK path in the outputs directory: /bitrise/src/app/build/outputs/apk/release/app-release-unsigned.apk.
Uploading APK to Firebase App Distribution…

How can I configure Gradle Runner to use the signed apk?



So, I don’t think you’ll be able to directly input it via steps, but you can do so via an environment variable. The signing step gives you BITRISE_SIGNED_APK_PATH, or BITRISE_SIGNED_APK_PATH_LIST, which you can then input in the Gradle script directly. Looking at the Firebase documentation, you can do something like:

 buildTypes {
    release {
        firebaseAppDistribution {
            apkPath if (System.getEnv("BITRISE_IO")) { System.getEnv("BITRISE_SIGNED_APK_PATH")}

Or something to that extent. Hope this somehow helps?