I am facing an issue after installing and implementing in-app purchase plugin Flutter team provided. What I did so far:
InAppPurchaseConnection.enablePendingPurchases();
at the app launchbool available = await _iap.isAvailable();
if (!available) {
print('=========> The store cannot be reached or accessed.');
} else {
Set<String> _kIds = {'farm', 'forest'};
ProductDetailsResponse productsResponse = await _iap.queryProductDetails(_kIds);
List<ProductDetails> products = productsResponse.productDetails;
}
}
queryProductDetails
crashes every single time with the following log:E/AndroidRuntime( 9053): java.lang.NoSuchMethodError: No virtual method getIntroductoryPriceCycles()Ljava/lang/String; in class Lcom/android/billingclient/api/SkuDetails; or its super classes (declaration of 'com.android.billingclient.api.SkuDetails' appears in /data/app/com.my.fancy.app-6ImcBn8ELPgiO8hTXXp_3Q==/base.apk)
E/AndroidRuntime( 9053): at io.flutter.plugins.inapppurchase.Translator.fromSkuDetail(Translator.java:27)
E/AndroidRuntime( 9053): at io.flutter.plugins.inapppurchase.Translator.fromSkuDetailsList(Translator.java:49)
E/AndroidRuntime( 9053): at io.flutter.plugins.inapppurchase.MethodCallHandlerImpl$1.onSkuDetailsResponse(MethodCallHandlerImpl.java:185)
E/AndroidRuntime( 9053): at com.android.billingclient.api.zzj.run(com.android.billingclient:billing@@3.0.0:8)
E/AndroidRuntime( 9053): at android.os.Handler.handleCallback(Handler.java:873)
E/AndroidRuntime( 9053): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 9053): at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime( 9053): at android.app.ActivityThread.main(ActivityThread.java:6746)
E/AndroidRuntime( 9053): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 9053): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime( 9053): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I've tried running this on multiple example projects, and it fails. Tried with both Kotlin and Java project, just to see if there is something buggy with one or the other, but no luck.
EDIT (fixed the issue): Issue was result of a billingClient linked in build.gradle file that was causing this issue. Once I removed it from gradle file, everything started working as expected.
The first thing to do is to add the Crash Catch library to your pubspec. yaml file under the dependencies. An example is below, ensure that the version number is the latest version number that is shown on the GitHub repositories tags.
Setup for Android You need to create at least an alpha version of your application, which allows you to test Google in-app purchases locally on your device. Now, head to the Store presence tab. Follow In-app products, then Managed products.
This took a while, but none of the above seemed to work for me. I found out, as I'm also using RevenueCat that the two dependencies were clashing. As of today resolving purchases_flutter to 1.2.1 instead of 1.4.3 resolved this for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With