ChatGPT解决这个技术问题 Extra ChatGPT

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

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.


A
Arturs Smirnovs

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

"Google Developer Console" > "APIs & Auth" subcategory "APIs" > (api list) "Google Play Android Developer API". Set "STATUS" to "ON". "APIs & auth" subcategory "Credentials" > "Create new Client ID". Choose "Service account" and create the id. You should get a P12 key from the browser.

Google Play Developer Console

"Google Play Developer Console" > "Settings" > subcategory "API access". Make a link to your "Linked Project". "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.


Yes this worked, thank you! I posted a php sample here: stackoverflow.com/a/25825907/1745234
Remember that, you can not create more than one "Linked Project" in Google Play Developer Console. So, you can use the same .p12 file in all of your projects.
Can I call play developer API from Android APP?
In step 2 of Google Play Console, what should we select in [Select a Role] dropdown menu?
This guide was a bit old. Here a more up-to-date version: Google Cloud Platform: console.cloud.google.com/home/dashboard Hambuger menu → Apis & Services → Credentials Manage Service accounts Create Service Account Name it and press Create Role: Token Creator Continue Create Key P12 / JSON Done
A
Andrea Scalabrini

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.


Creating all products new finally solved the issue for me, thanks!
Same here, but I just created a new temporal product, then I just deleted it :)
Is this a viable solution if there are users who purchased the products?
I was able to fix by setting each product as "INACTIVE", then save, then make "ACTIVE" again.
Works also by setting just a single product to inactive and then back to active state
A
AFT

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


+1000, would never have figured that out from that error message!
Same kind of "sync" happens when you inactivate and activate back your products from Google Play Console. Strange.
This saved me alot of time and pain!
This issue was driving me crazy and wasted so much of my time trying to figure this out. Thanks a lot. This is very strange. Google should do something about it.
I spent HOURS on this and THIS solved my problem
s
suquant

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:

Link your Google Cloud Console account to your Google Play Console if it isn't done yet. Then go to your subscriptions/products and try to change something there, for example, the price on a 0.01$ and roll it back. 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.


Can we change subscription price and roll it back again immediately ? i can not able to access Google Play Developer API Subscription get Access call ? I already have subscription created before and then link up project to google play console in API access could this be the cause ? should i change subscription price and roll it back ? will that work ?
@JayRathodRJ Yes, it should help, actually, that is what I am talking about here.
N
Nicholas Mordecai

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"
      }
    ]
  }
}

If you're signed into multiple Google accounts, it will be hard to access this page using the correct one due to all the redirects. You're best off using incognito mode to sign into the correct Google account.
c
coolcool1994

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.


a
augustocbx

Check your fastlane/Appfile.

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


x
xkxeeshankhan

In case of codemagic

So in my case the problem was because of the Service account key, the json key was created before the access/permission was granted to that service account, so after deleting the old key and creating a new one works for me.