Jump to content
Sign in to follow this  
Bilcan

Delphi 11 Google Play Billing v6

Recommended Posts

Hi,

 

Is it possible to migrate an app at Delphi 11 to Google Play v6? Or do I need to upgrade my Delphi version 12.1?

 

Thanks.

Share this post


Link to post
3 hours ago, Bilcan said:

Or do I need to upgrade my Delphi version 12.1?

Looking at the differences in the source code for FMX.InAppPurchase.Android.pas between Delphi 11.3 and 12.1, I'd say yes.

  • Like 1

Share this post


Link to post
Posted (edited)

Hi. In my app, I'm using Google Play Billing Library version 6.0.0 (billing-6.0.1.dex.jar). But a few days ago, Google Play Console notified me that:

Quote

Your app uses an old version of Google Play Billing Library. Starting August 31, 2025, all apps must use version 7.0.0 or higher.
Update to a newer version by the deadline, or your app updates will be rejected.

 

Is it possible to migrate to Google Play Billing Library version 7.0.0 or newer in Delphi 12.1 CE? Has anyone already done this? I couldn't find anything useful on Google.

Edited by apachx

Share this post


Link to post
8 hours ago, apachx said:

Is it possible to migrate to Google Play Billing Library version 7.0.0 or newer in Delphi 12.1 CE?

Possibly. Note that I am unsure as to whether the following will work, since I have not tested it. The steps are quite involved, so please take this into account before proceeding. 

 

In theory, the steps are to obtain the required .jar files, i.e.

 

billing-7.0.0.jar
play-services-base-18.3.0.jar
play-services-basement-18.3.0.jar
play-services-tasks-18.1.0.jar

Which is the updated billing jar (of course), however the others are the versions of the jars that billing-7.0.0.jar is dependent on, of which Delphi 12.1 uses earlier versions. If you go to the Maven Repository site:

https://mvnrepository.com/artifact/com.android.billingclient/billing/7.0.0

 

You can see the dependencies listed, as well as a link to the .aar file (which are in .zip format) that contains a classes.jar file that corresponds to billing-7.0.0.jar, i.e. you can rename the .aar to .zip, extract classes.jar and rename it to billing-7.0.0.jar.

 

image.thumb.png.8b8908354ff8e82f7cf34fe63e41558f.png

 

If you follow the links to the dependent jars (the links in the Version column of the dependencies list) - just the ones I have listed above, you can repeat the process of downloading the .aar, rename it to .zip, extract classes.jar and rename it to the relevant name.

 

The next step would be to disable the "default" jars in Project Manager for your project, by navigating to Libraries node under the Android 32-bit target, right-clicking billing-6.0.1.dex.jar and clicking Disable, repeating this for play-services-base-18.1.0.dex.jar, play-services-basement-18.1.0.dex.jar and play-services-tasks-18.0.2.dex.jar, the repeat the process for the Android 64-bit target.

 

Then, you would need to add the replacement jar files to the Android 32-bit target (they will not need to be added to Android 64-bit) by right-clicking the Libraries node, clicking Add, selecting the replacement jar files (listed above) and clicking OK.

 

Next, you would need to edit the AndroidManifest.xml file in the project output folder (i.e. not AndroidManifest.template.xml), because Delphi 12.1 would be generating this line: (at least in theory - I do not have Delphi 12.1)

<meta-data android:name="com.google.android.play.billingclient.version" android:value="6.0.1" />

Which will need to be changed to this:

<meta-data android:name="com.google.android.play.billingclient.version" android:value="7.0.0" />

You would need to save this edited AndroidManifest.xml file somewhere convenient, perhaps in the root folder of your project. It needs to be added to the deployment of the project using Deployment Manager (Project | Deployment from the main menu in Delphi). You may note that there is an existing entry for the local name of AndroidManifest.xml. You will need to disable this existing entry by unchecking the checkbox, e.g:

image.thumb.png.6058ec81526fd4e2f5d6e0fe515d6769.png

..then add the modified version by clicking the button second from the left, and selecting the edited AndroidManifest.xml file. Note that if you later make any changes to your project that affect the Android manifest, you will need to repeat the manifest edit/copy steps.

 

Hopefully, that should complete all the steps. Please remember the warning I made at the beginning 🙂
 

Share this post


Link to post
Posted (edited)
14 hours ago, Dave Nottage said:

 

Hopefully, that should complete all the steps. Please remember the warning I made at the beginning 🙂
 

Wow, thank you! I'll try it out.

 

Upd: I followed all the steps exactly as you described. The project compiled without any issues, and I’ve already published it on the Play Store. I tested the in-app subscriptions using a test account - everything works perfectly, no issues noticed. Now I'll wait and see if Google approves the changes. Great tutorial - simple and very clear. Thanks again!

Edited by apachx

Share this post


Link to post
On 7/10/2025 at 1:08 AM, Dave Nottage said:

Possibly. Note that I am unsure as to whether the following will work, since I have not tested it. The steps are quite involved, so please take this into account before proceeding. 

 

In theory, the steps are to obtain the required .jar files, i.e.

 

billing-7.0.0.jar
play-services-base-18.3.0.jar
play-services-basement-18.3.0.jar
play-services-tasks-18.1.0.jar

Which is the updated billing jar (of course), however the others are the versions of the jars that billing-7.0.0.jar is dependent on, of which Delphi 12.1 uses earlier versions. If you go to the Maven Repository site:

https://mvnrepository.com/artifact/com.android.billingclient/billing/7.0.0

 

Interestingly, after making these changes and publishing my app to the Play Market, the Play Console notification about upgrading the Google Play Billing library disappeared, and everything seemed fine for quite a while. But a few days ago, this notification reappeared, and now I’m wondering: how exactly does Google determine that I’m still using the wrong version of the Google Play Billing library?

In my project, I disabled the old libraries:

  • billing-6.0.1.jar

  • play-services-base-18.1.0.jar

  • play-services-basement-18.1.0.jar

  • play-services-tasks-18.0.2.jar

and replaced them with the new version 7.0.0, according to the instructions. I also made the corresponding changes in the AndroidManifest.xml.

I then built the .aab file and opened it with jadx-gui to analyze the package tree for any usage of billing-6.0. I couldn’t find a single reference to the old billing library. A text search for "6.0" returns nothing, while a search for "7.0" correctly shows the new library billing@@7.0.0.

 

So why does Google Play Console still conclude that I’m using billing-6.0.1?

 

image.thumb.png.f4f6d1e339b1c283f163672cf039f5eb.png

Share this post


Link to post
4 hours ago, apachx said:

So why does Google Play Console still conclude that I’m using billing-6.0.1?

I expect you've missed (or somehow it has changed) at least the last part of this, notably: disabling the original deployment of AndroidManifest.xml and adding the edited version to the deployment. 

On 7/10/2025 at 7:38 AM, Dave Nottage said:

Next, you would need to edit the AndroidManifest.xml file in the project output folder (i.e. not AndroidManifest.template.xml), because Delphi 12.1 would be generating this line: (at least in theory - I do not have Delphi 12.1)


<meta-data android:name="com.google.android.play.billingclient.version" android:value="6.0.1" />

Which will need to be changed to this:


<meta-data android:name="com.google.android.play.billingclient.version" android:value="7.0.0" />

You would need to save this edited AndroidManifest.xml file somewhere convenient, perhaps in the root folder of your project. It needs to be added to the deployment of the project using Deployment Manager (Project | Deployment from the main menu in Delphi). You may note that there is an existing entry for the local name of AndroidManifest.xml. You will need to disable this existing entry by unchecking the checkbox, e.g:

image.thumb.png.6058ec81526fd4e2f5d6e0fe515d6769.png

..then add the modified version by clicking the button second from the left, and selecting the edited AndroidManifest.xml file. Note that if you later make any changes to your project that affect the Android manifest, you will need to repeat the manifest edit/copy steps.

 

Edited by Dave Nottage

Share this post


Link to post
1 hour ago, Dave Nottage said:

I expect you've missed (or somehow it has changed) at least the last part of this, notably: disabling the original deployment of AndroidManifest.xml and adding the edited version to the deployment. 

 

I also did this step according to the instructions. When building the project for the Application Store, in the \Android64\Release\MyProject folder there is an AndroidManifest.xml file with the correct line:

android:name="com.google.android.play.billingclient.version" android:value="7.0.0"

image.thumb.png.3d4caee728a8086c490a62a5d1d65882.png

 

But jadx-gui shows a completely different AndroidManifest.xml under Resources\base\manifest\AndroidManifest.xml.

 

image.thumb.png.08bc51bb6f2151d791d3e49b9499a3e2.png

 

It looks like I must have messed something up somewhere. I’ll start by removing the 32-bit version and keep only the 64-bit one as the target platform.

Share this post


Link to post
54 minutes ago, apachx said:

It looks like I must have messed something up somewhere. I’ll start by removing the 32-bit version and keep only the 64-bit one as the target platform.

I’ve just double-checked everything, rebuilt the project, and yet Delphi still writes the following line into the AndroidManifest.xml inside the .aab file:

android:name="com.google.android.play.billingclient.version" android:value="6.0.1" /> 

Is it possible that something in the IDE settings needs to be changed?

Share this post


Link to post
7 hours ago, apachx said:

Is it possible that something in the IDE settings needs to be changed?

It's very possible that you need to correct something. For the steps related to deployment of AndroidManifest.xml, once again:

1. Deploy the project in the desired mode (Debug or Release) at least once so that the AndroidManifest.xml file is generated (obviously you do not need to do this on this occasion, since you already have)
2. Copy AndroidManifest.xml from the Debug or Release folder to, for example, the root of the project folder

3. Modify the meta-data entry in the copy of AndroidManifest.xml to:

<meta-data android:name="com.google.android.play.billingclient.version" android:value="7.1.1" />

4. Disable the default deployment of AndroidManifest.xml, and add a deployment for the edited AndroidManifest.xml (to the same remote path, which is .\):

image.thumb.png.c67adf034d9135f36afc05cd9809b1c6.png

 

I just did this myself, even though I was using Delphi 12.3 (I just changed the version value in the meta-data to something different), deployed for app store and the resulting AndroidManifest.xml in the .aab file is correct.

 

Share this post


Link to post
44 minutes ago, Dave Nottage said:

I just did this myself, even though I was using Delphi 12.3 (I just changed the version value in the meta-data to something different), deployed for app store and the resulting AndroidManifest.xml in the .aab file is correct.

 

I’m doing exactly that.

 

image.thumb.png.9fc6ad027ac061b2de563b059d5d5f6a.png

 

But for some reason, Delphi 12.1 ignores the AndroidManifest.xml I create and takes the data from AndroidManifest.template.xml. If I delete AndroidManifest.template.xml, it gets recreated every time during deployment.

I even tried adding this section in it:

<meta-data android:name="com.google.android.play.billingclient.version" android:value="7.0.0" /> 

But immediately after that, Delphi still adds the same line with the old library version to the final AndroidManifest.xml:

<meta-data android:name="com.google.android.play.billingclient.version" android:value="7.0.0" /> 
<meta-data android:name="com.google.android.play.billingclient.version" android:value="6.0.1" />

Share this post


Link to post
7 minutes ago, apachx said:

But for some reason, Delphi 12.1 ignores the AndroidManifest.xml

Sorry, I forgot about this issue. (I blame my aging brain)

 

Which is another good reason to keep up with the latest version of Delphi, especially when targeting mobile.

Share this post


Link to post
25 minutes ago, Dave Nottage said:

Sorry, I forgot about this issue.

Got it, thanks for the helpful information! In that case, I’ll use a more "brute-force" approach => I’ll comment out the <%application-meta-data%> line in AndroidManifest.template.xml and replace it with:

<meta-data android:name="com.google.android.play.billingclient.version" android:value="7.0.0" />

Share this post


Link to post
1 minute ago, apachx said:

In that case, I’ll use a more "brute-force" approach

Yes, as long as all other required meta-data is present. Well done! 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×