Fastlane & Flutter - Google Api Error: Invalid request - Access Not Configured. Google Play

Viewed 3159

What causes this error when using Fastlane and Flutter after running this :

bundle exec fastlane beta

Google Api Error: Invalid request - Access Not Configured. Google Play Developer API has not been used in project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/androidpublisher.googleapis.com/overview?project=xxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

When the Service Account is enabled and linked to the Play Store account with Release Manager, I read different conversations on github, but I couldnt get clear answers, I tried to increase the version of my APK since I uploaded one, but no luck.

This is my code in the Fastfile :

update_fastlane

default_platform(:android)

platform :android do
  desc "Runs all the tests"
  lane :test do
    gradle(task: "test")
  end

  desc "Deploy an beta new version to the Google Play"
  lane :beta do
       gradle(
           task: 'assemble',
           build_type: 'Release'
         )
     upload_to_play_store(track: 'beta',
     version_code: 5,
     aab: '../build/app/outputs/bundle/release/app-release.aab',
     )
   end
end

Then also it says somewhere, that :

[11:16:18]: Couldn't find any new signed apk files...

yet I provided the path to the aab.

Anyone who can quickly unblock me please

4 Answers
desc "Deploy a new beta build to Google Play"
   lane :beta do
     build_number = number_of_commits()
     Dir.chdir "../.." do
       sh("flutter", "packages", "get")
       sh("flutter", "clean")
       sh("flutter", "build", "appbundle", "--build-number=#{build_number}")
     end
      upload_to_play_store(track: 'beta', aab: '../build/app/outputs/bundle/release/app-release.aab')
   end

It happens when you try to publish a .aab file when an existing app was rejected by the play store.

There are 2 ways to work around the error:

  1. Resolve the rejection and submit again
  2. Upload .aab via web google play console for eg. in Alpha - Closed testing track, publish it and status should be set as "Changes in review"

Reference link of this solution on Github

This Google API Error is due to Policy not set on the Play Store console and per @Rachit Rawat's answer above. Another thing you can do is to delete your already accepted apk/aab file and submit again.

check out my lesson learned: https://issuetracker.google.com/issues/234820023#comment31

You are creating an apk with task: "assemble", just change it for task: "bundle".

Related