Alqueraf
Alqueraf

Reputation: 1378

Flutter InAppPurchase products not showing on release build

I've added the in_app_purchase flutter package and was working fine on debug (followed the setup instructions etc.) but when I build the release apk it cannot find any of the products, all are returned under notFoundIDs without stating any error.

I've tried flutter clean. Also Tried using the exact same buildTypes config on both, same result.

Any idea why the release build would not return any queried items? Thanks.

Upvotes: 1

Views: 1273

Answers (2)

Mihail P
Mihail P

Reputation: 111

You need to use a reserved SKU for the test: android.test.purchased

const List<String> _kProductIds = <String>[
  'android.test.purchased'
];
ProductDetailsResponse productDetailResponse =
  await _connection.queryProductDetails(_kProductIds.toSet());

Upvotes: 0

Alqueraf
Alqueraf

Reputation: 1378

Well, found the problem, apparently queryProductDetails([...]) needs to be called after isAvailable() returns true.

I had both calls running asynchronously and for some reason it was working in debug mode but not release.

Upvotes: 4

Related Questions