Firebase App Distribution found more than 1 output file for this variant
Asked Answered
P

2

6

I am adding "Firebase App Distribution" based on Google document to my Android application but after running appDistributionUploadRelease Gradle task I get this error message:

10:18:03 PM: Executing task 'appDistributionUploadRelease'...

Executing tasks: [appDistributionUploadRelease] in project C:\Users\mohsenoid\development\***\***-Android


> Task :app:appDistributionUploadRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:appDistributionUploadRelease'.
> App Distribution found more than 1 output file for this variant. Please contact [email protected] for help using APK splits with App Distribution.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 19s
1 actionable task: 1 executed
10:18:23 PM: Task execution finished 'appDistributionUploadRelease'.

FYI, my app has splits output APKs based on different ABIs:

splits {
    // Configures multiple APKs based on ABI.
    abi {
        // Enables building multiple APKs per ABI.
        enable true

        // By default all ABIs are included, so use reset() and include to specify that we only
        // want APKs for x86, armeabi-v7a, and mips.
        reset()

        // Specifies a list of ABIs that Gradle should create APKs for.
        include "armeabi-v7a", "arm64-v8a"

        // Specifies that we want to also generate a universal APK that includes all ABIs.
        universalApk true
    }
} 

and I guess that is why this plugin is confused about which APK to upload.

Here is the list of apks which are being created after build:

app-arm64-v8a-release.apk
app-armeabi-v7a-release.apk
app-universal-release.apk

UPDATE:

I went through the plugin source code and noticed that there is an undocumented property called apkPath which I should set, but still, no success.

Pentecost answered 2/10, 2019 at 20:31 Comment(3)
I already contacted Google Firebase support team and waiting for their response and will update this question if I get an answer.Pentecost
I tried to implement this answer which is based on Crashlytics Fabric Distribution but I was not successful: https://mcmap.net/q/1500614/-fabric-beta-and-apk-splitsPentecost
Here is Firebase support team response: "Currently App Distribution doesn't support Android App Bundles or ABI splits. It's on our roadmap, but there is no ETA or time we can share as of now. Please keep an eye out on our release notes or blog post for any product updates."Pentecost
P
6

After decompiling and reverse-engineering the Firebase App distribution jar file and reading the code I found this solution:

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // Filter is null for universal APKs.
        def filter = output.getFilter(OutputFile.ABI)

        if (filter == null) {
            tasks.findAll {
                it.name.startsWith(
                        "appDistributionUpload${variant.name.capitalize()}")
            }.each {
                it.doFirst {
                    it.appDistributionProperties.apkPath = output.outputFile.absolutePath
                }
            }
        }
    }
}

Note: You have to execute assemble and app distribution upload Gradle tasks one after another:

./gradlew assembleRelease appDistributionUploadRelease

Pentecost answered 7/10, 2019 at 11:58 Comment(1)
this also fixes if you rename your apk dynamically (with current date etc)Cyclone
M
0

I fixed the issue by setting the apkPath:

firebaseAppDistribution {
    artifactPath="$rootDir/app/build/outputs/apk/...etc...[universal].apk"
    serviceCredentialsFile="..."
    testers="[email protected]"
}

I'm using the version 2.1.2

Mussman answered 18/6, 2021 at 8:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.