Skip to main content
Question

Why do I get the exception that "queryPurchases" is a non-existent method?


Forum|alt.badge.img+3

Hello

I want to use billing client v4(Google) with purchases_flutter over 3.4.0 and flutter 3.1.1.

but “java.lang.NoSuchMethodError: No virtual method queryPurchases" occured at this code.

1await Purchases.setup(publickey);

and stack trace is this.

1D/[Purchases] - DEBUG(21733): ℹ️ API request started: GET /subscribers/oDNEWTpax9Xkz0FVC3tdoRzdPbh1/offerings
2D/[Purchases] - DEBUG(21733): ℹ️ API request completed with status: GET /subscribers/oDNEWTpax9Xkz0FVC3tdoRzdPbh1/offerings 304
3D/[Purchases] - DEBUG(21733): ℹ️ Requesting products from the store with identifiers: jp.kazushige.sato.suudoku.month1, jp.kazushige.sato.suudoku.month6, jp.kazushige.sato.suudoku.month12
4D/[Purchases] - DEBUG(21733): ℹ️ Requesting products from the store with identifiers: jp.kazushige.sato.suudoku.month1, jp.kazushige.sato.suudoku.month6, jp.kazushige.sato.suudoku.month12
5D/[Purchases] - DEBUG(21733): ℹ️ Querying purchases
6E/AndroidRuntime(21733): FATAL EXCEPTION: Thread-11
7E/AndroidRuntime(21733): Process: jp.kazushige.sato.suudoku, PID: 21733
8E/AndroidRuntime(21733): java.lang.NoSuchMethodError: No virtual method queryPurchases(Ljava/lang/String;)Lcom/android/billingclient/api/Purchase$PurchasesResult; in class Lcom/android/billingclient/api/BillingClient; or its super classes (declaration of 'com.android.billingclient.api.BillingClient' appears in /data/app/~~QXhhaysmqhTSoVemfw98mQ==/jp.kazushige.sato.suudoku-JH2QFUYsyY55fD9UUgTEdw==/base.apk)
9E/AndroidRuntime(21733): at com.revenuecat.purchases.google.BillingWrapper$queryPurchases$1.invoke(BillingWrapper.kt:383)
10E/AndroidRuntime(21733): at com.revenuecat.purchases.google.BillingWrapper$queryPurchases$1.invoke(BillingWrapper.kt:53)
11E/AndroidRuntime(21733): at com.revenuecat.purchases.google.BillingWrapper.withConnectedClient(BillingWrapper.kt:593)
12E/AndroidRuntime(21733): at com.revenuecat.purchases.google.BillingWrapper.queryPurchases(BillingWrapper.kt:380)
13E/AndroidRuntime(21733): at com.revenuecat.purchases.Purchases$updatePendingPurchaseQueue$1.run(Purchases.kt:1707)
14E/AndroidRuntime(21733): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
15E/AndroidRuntime(21733): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
16E/AndroidRuntime(21733): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
17E/AndroidRuntime(21733): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
18E/AndroidRuntime(21733): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
19E/AndroidRuntime(21733): at java.lang.Thread.run(Thread.java:923)
20D/[Purchases] - DEBUG(21733): ℹ️ Products request finished for jp.kazushige.sato.suudoku.month1, jp.kazushige.sato.suudoku.month6, jp.kazushige.sato.suudoku.month12
21
22I/Process (21733): Sending signal. PID: 21733 SIG: 9
23Lost connection to device.

method “queryPurchases" is deprecated method at billing client v4.0 but can be used.

and the  method is obsolete in v5.0.

Looking at this stack trace, it appears as if the revenuecat library is referencing v5.

If it references v4, why does it raise an exception that the method does not exist?

thanks 

This post has been closed for comments

3 replies

Forum|alt.badge.img+3
  • Author
  • New Member
  • 2 replies
  • August 30, 2022

this issue has resolved by myself

 

It was because a completely different plugin was referencing v5. After temporarily removing that plugin, the exception no longer occurred.


Cesar
RevenueCat Staff
Forum|alt.badge.img+3
  • RevenueCat Staff
  • 65 replies
  • August 30, 2022

Glad you got it fixed. Do you mind sharing the name of the plugin you were using? That way other devs can remove it in case they have the same issue


Forum|alt.badge.img+3
  • Author
  • New Member
  • 2 replies
  • August 31, 2022

Thank you, Cesar.

that plugin is in_app_purchase 2.0.1

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings