Skip to content

App Distribution Plugin - serviceCredentialsFile in build.gradle.kts is global, build.gradle works well #5651

@JohnZh

Description

@JohnZh

[READ] Step 1: Are you in the right place?

Yes

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Giraffe 2022.3.1 Patch 1
  • Firebase Component: App Distribution Gradle Plugin
  • Component version: 4.0.1
  • Gradle version: 8.0.2

[REQUIRED] Step 3: Describe the problem

Same problem as this one: #5291
(#5291)

Steps to reproduce:

My application is configured to multiple flavors, and push APK to the firebase app distribution based on the flavors

Here is some code from my app-level build.gradle.kts

create("demo") {
      dimension = "version"
      applicationId = "jp.co.kakuyasu.app.dev"
      firebaseAppDistribution {
          artifactType = "APK"
          groups = "testers"
          releaseNotesFile = "ci/release-log.txt"
          serviceCredentialsFile = "${project.rootDir}/ci/demo-credential-file.json"
      }
  }
  create("demo2") {
      dimension = "version"
      applicationId = "jp.co.kakuyasu.app.stg"
      firebaseAppDistribution {
          artifactType = "APK"
          groups = "testers"
          releaseNotesFile = "ci/release-log.txt"
          serviceCredentialsFile = "${project.rootDir}/ci/demo2-firebase-credential-file.json"
      }
  }

When I upload my first build(Demo), it just use my second serviceCredentialsFile(demo2-firebase-credential-file.json)

> Task :app:appDistributionUploadDemoDebug
Using APK path in the outputs directory: /Users/john/Desktop/kakuyasu-android/app/build/outputs/apk/demo/debug/app-demo-debug.apk.
Uploading APK to Firebase App Distribution...
Using service credentials file specified by the serviceCredentialsFile property in your app's build.gradle file: /Users/john/Desktop/kakuyasu-android/ci/demo2-firebase-credential-file.json
Uploading the APK.

> Task :app:appDistributionUploadDemoDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:appDistributionUploadDemoDebug'.
> App Distribution halted because it had a problem uploading the APK: [403] The caller does not have permission

After I reviewed the same issue: #5291
I convert my build.gradle.kts to build.gradle(groovy version). And it works.

Demo flavor uses the demo-credential-file.json, and demo2 flavor uses demo2-firebase-credential-file.json.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions