Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.13k stars 341 forks source link

Access Not Configured. Google Play Developer API #823

Closed mrcarromesa closed 4 years ago

mrcarromesa commented 4 years ago

Describe the bug

I am unable to send the apk to Google Play. I performed all the steps to access the API according to Service Account

I configured the app / build.gradle

I created and submitted the project manually on Google Play to generate the package name

In my project I ran the command: ./gradlew bootstrap and communicates correctly with Google Play and downloads the metadata

However, when executing the command ./gradlew publishApk when starting the upload to Google Play it gives the following error:

* What went wrong:
Execution failed for task ': app: publishReleaseApk'.
> A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishApk $ Processor
   > There was a failure while executing work items
      > A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishApk $ ApkUploader
         > 403 Forbidden
           POST https://www.googleapis.com/upload/androidpublisher/v3/applications/PACKAGE_NAME/edits/NUMBER/apks?uploadType=resumable
           Access Not Configured. Google Play Developer API has not been used in project NUMBER before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/androidpublisher.googleapis.com/overview?project=NUMBER then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

How To Reproduce

Versions

\--- com.github.triplet.play:com.github.triplet.play.gradle.plugin:2.8.0
     \--- com.github.triplet.gradle:play-publisher:2.8.0
          +--- com.github.triplet.gradle:android-publisher:2.8.0
          |    +--- com.github.triplet.gradle:common-utils:2.8.0
          +--- com.github.triplet.gradle:common-utils:2.8.0
          +--- com.github.triplet.gradle:common-validation:2.8.0
Gradle 6.2
\--- com.android.tools.build:gradle:3.6.0

Tasks executed

./gradlew publishApk

Expected behavior

I expected you to send the apk to Google Play

Additional context (if a crash, provide stack trace)

I tried using fastlane too and the same error occurs: [Google Api Error: Invalid request - Access Not Configured] (https://github.com/fastlane/fastlane/issues/16593)

So I don't know if it's a configuration problem on the Google console, or something

RationalRank commented 4 years ago

Describe the bug

I was experiencing the same today when I tried the "In App Updates" feature. I was able to successfully publish to internal track at first with update priority set to "0.5". But, the play core API still returned UPDATE_NOT_AVAILABLE. I tried creating an Edit in a python script using the google api client librarby and found that the tracks.releases didn't have the inAppUpdatePriority key for the update I pushed using GPP. Ref:

{
  "track": "internal",
  "releases": [
    {
      "name": "X",
      "versionCodes": [
        "X"
      ],
      "releaseNotes": [
        {
          "language": "en-US",
          "text": "- Testing in app updates"
        }
      ],
      "status": "completed"
    }
  ]
}

Then I tried to push a new update in draft status in the same internal track and I received 403 successively.

Error message:

* What went wrong:
Execution failed for task ':app:publishReleaseBundle'.
> A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishBundle$BundleUploader
   > 403 Forbidden
     POST https://www.googleapis.com/upload/androidpublisher/v3/applications/PACKAGE_NAME/edits/EDIT_IT/bundles?uploadType=resumable
     Access Not Configured. Google Play Developer API has not been used in project X before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/androidpublisher.googleapis.com/overview?project=X then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

How To Reproduce

Versions

Gradle Play Publisher: 2.8.0 Gradle Wrapper: 6.2.2 Android Gradle Plugin: 4.0.0

Tasks executed

./gradlew publishBundle --artifact-dir RELEASE_DIR_PATH/app-release.aab

@SUPERCILEX I'm not sure if this is a bug in the library, I presume not. Can you please share if you know when this could possibly occur?

SUPERCILEX commented 4 years ago

Did you guys click the link it keeps complaining about? And are these perms specified? https://github.com/Triple-T/gradle-play-publisher/blob/master/assets/min-perms.png

RationalRank commented 4 years ago

@SUPERCILEX Yes, the service account has the project owner role and that project is linked in the Google Play Devloper Console which has Release Manager access.

The link it keeps throwing redirects to GCP's Google Play Developer API which is already enabled.

SUPERCILEX commented 4 years ago

Hmmm, maybe check the quotas? https://console.cloud.google.com/apis/api/androidpublisher.googleapis.com/quotas

mrcarromesa commented 4 years ago

I already submitted the application manually to create the package name.

I performed all configuration according to: Service Account

I tried to define the owner type, after the Service Account User type, and after the Editor type, in all cases I got the same problem.

Quotas are too much within the limit

Follow the video of how the problem occurs: Error occurring

SUPERCILEX commented 4 years ago

You didn't show the GCP linking, just want to make sure it's right. In here: https://play.google.com/apps/publish/?noredirect#ApiAccessPlace. The "Linked project" needs to be the same GCP project in which you created the service account.

mrcarromesa commented 4 years ago

I tried to explain everything in this image correctly, I hope it is possible to understand, anything I try to explain better.

error

SUPERCILEX commented 4 years ago

That looks good, but please go to the link I sent you. It looks like this and should have the name of the GCP project from your screenshot (mine is Robot Scouter):

image

mrcarromesa commented 4 years ago

Sorry, now I understand, follow the image with the name of the project Google Play Android Developer

Screen-Shot-2020-06-15-at-21-12-55

SUPERCILEX commented 4 years ago

And when you click on it what GCP project does it open? The project= part of the URL.

SUPERCILEX commented 4 years ago

It should be the same GCP project that you configured your service account with.

mrcarromesa commented 4 years ago

When I click I'm redirected to https://console.developers.google.com/apis/dashboard?project=api-5602495227267580652-504039

the same as the image (https://github.com/Triple-T/gradle-play-publisher/issues/823#issuecomment-644449887)

SUPERCILEX commented 4 years ago

Yup, that looks good. I can't think of anything else that could be wrong, so I'm going to close this issue as it isn't related to GPP. Your best course of action is going to be contacting Play support, especially since it's probably a bug on their end.