Fastlane fails with uploading APK to Firebase App Distribution in CI

92 Views Asked by At

I have a flutter app and use fastlane on a CI server to build and upload to Google Play Console and Firebase App Distribution.

When aiming for Play Console the upload of the AAB is stopped with "Google Api Error: Invalid request - Only releases with status draft may be created on draft app". I understand that this is caused from not having a published track on Play console (which requires filling out app details and uploading screenshots to send to Google for review).

When aiming for Firebase App Distribution with APK (since AAB only works under same condition as mentioned above) I get "Invalid request" error after "Uploading the APK Lane Context: :DEFAULT_PLATFORM=>:android, :PLATFORM_NAME=>:android, :LANE_NAME=>"android deploy_draft_to_firebase" in the logs. A few lines below: "bundler: failed to load command: fastlane (/usr/local/bin/fastlane) /var/lib/gems/2.7.0/gems/google-apis-core-0.11.3/lib/google/apis/core/http_command.rb:244:in `check_status': \e[31m[!] Invalid request\e[0m (Google::Apis::ClientError)"

My fastfile looks like this:

  default_platform(:android)

  platform :android do
   
   desc: "Google Play Console Internal Testing"
   lane :deploy_draft_to_internal do
    sh("flutter build appbundle -v")

    upload_to_play_store(
        track: 'internal',
        release_status: 'draft',
        skip_upload_changelogs: true,
        aab: "../build/app/outputs/bundle/release/app-release.aab"
    )
  end

  lane :deploy_draft_to_firebase do
    sh("flutter build apk -v")

    firebase_app_distribution(
        app: "1:9..........:android:a.............",
        testers: "[email protected]",
        android_artifact_type: "APK",
        android_artifact_path: "../build/app/outputs/apk/release/app-release.apk",
        service_credentials_file: "firebase_app_distribution_credentials.json"
        )
  end
end

When I added debug: "true" in firebase_app_distribution logs showed a 403 error.

I install the firebase plugin during CI run and it is available.

0

There are 0 best solutions below