77
votes

I am getting the following error while accessing Google Play Developer API using a service account:

The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.

The service account email and .p12 file were generated using the service account option in APIs&Auth -> Credentials. The Application in the Google Play Developer API was linked to the project using the project id as mentioned in google's docs.

However, I am still getting this error when I try to use the Publishing API. I am looking for a solution to this error and a step by step process to use the Google Publishing API for the Java client to publish an APK using the Google Play Developer API. I am using androidpublisher_v2_public.

7

7 Answers

121
votes

I understand you. Google confuses you with changing service names and workflows. Their documents aren't updated enough to match their newest API workflows.

I was using the Google Play Developer Service API v2 on the server-side with an alpha-version APK, and had the same error as you: "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."

This is my solution:

Google Developer Console

  1. "Google Developer Console" > "APIs & Auth" subcategory "APIs" > (api list) "Google Play Android Developer API". Set "STATUS" to "ON".

  2. "APIs & auth" subcategory "Credentials" > "Create new Client ID". Choose "Service account" and create the id.

  3. You should get a P12 key from the browser.

Google Play Developer Console

  1. "Google Play Developer Console" > "Settings" > subcategory "API access".

  2. Make a link to your "Linked Project".

  3. "Service Account" place may be already showing your "Service account" CLIENT ID which made "google developer console".

By default this account is gray indicating that it is not active. So you must activate it and set authority manually.

You should now get a correct response from the API.

If you get the same error again, maybe is because you have configured and purchased products in your console before linking the project.

To solve it, simply add new product in your app.

Good luck.

37
votes

Got the same error trying to validate in-app purchases.

This has worked for me:

Go to

Google Play Developer Console > Settings > API Access.

Find your project under "Linked Project" and click "Link" button.

If you get the same error again, maybe is because you have configured and purchased products in your console before linking the project.

To solve it, simply add new product in your app.

24
votes

If you receive this response when making a request to Android Publisher API, but your project is already linked try to create new In-App Product. If there is a product created before linking, it fails on product transaction fetching when making a purchase. With new product, error goes away.

https://dev.to/sandris/androidpublisher--projectnotlinked-error-43c7

1
votes

A couple of days ago I've faced the same problem described here with an android publisher v3 and I did all by instruction but unfortunately unsuccessfully.

It may happen when you did link your google cloud console after than your subscriptions/products created and here I'm gonna describe the tricky solution on how to solve this problem without even contacting google.

I've thought that it might be the problem of synchronization and did a couple of steps.

Solution:

  1. Link your Google Cloud Console account to your Google Play Console if it isn't done yet.
  2. Then go to your subscriptions/products and try to change something there, for example, the price on a 0.01$ and roll it back.
  3. Then do it with all the rest subscriptions/products

Finally, check your integration again. I hope everything should get working now :)

Also, I hope #google will fix these issues soon.

1
votes

Should anybody have an issue on trying to find where to link the project (as the interface keeps changing) here's is a current link to their API docs

Google Play Developer API

And if you want a direct link (should their docs change as per usual) then you can find the link page at:

play.google.com/apps/publish/?account=<your_account_id>#ApiAccessPlace

Just for reference, I'm trying to reconcile subscriptions on the server side and after all the oAuth 2.0 has been setup, I'm getting a 403 error :

  "error": {
    "code": 403,
    "message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
    "errors": [
      {
        "message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
        "domain": "androidpublisher",
        "reason": "projectNotLinked"
      }
    ]
  }
}
1
votes

Your problem may have caused because you created in-app purchase products before creating the service account.

In your developer console, set your in-app purchases product as "INACTIVE". Then save the page. Finally make then "ACTIVE" again. This will refresh things in Google's end, and make everything work.

0
votes

Check your fastlane/Appfile.

Your package_name match with your project package and the project created in your google account.