adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
88 stars 15 forks source link

Initialization error Adapty.setFallbackPaywalls #67

Closed samatzp closed 1 year ago

samatzp commented 1 year ago

Flutter 3.3.8 Adapty package: https://pub.dev/packages/adapty_flutter

Problem initializing Adapty.setFallbackPaywalls the custom_payload line has an error

Default from adapty Json:

E/Adapty_v1.11.0(22951): Couldn't set fallback paywalls. com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 26 column 13 path $.data[0].attributes.custom_payload

The line that indicates the error: "custom_payload": "{\"abTestData\":{\"resale_2ytz6bu\":false}}"

Manually removed \

Couldn't set fallback paywalls. com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 25 column 28 path $.data[0].attributes.custom_payload

The line that indicates the error:

"custom_payload": {"abTestData":{"resale_2ytz6bu":false}}

Put on custom_payload null

Everything is ok if: "custom_payload": null

vladd-g commented 1 year ago

@samatzhusup could you please send the fallback paywalls to our support so that we debug your case?

vladd-g commented 1 year ago

Some characters are treated as escape characters and omitted, so when creating a String variable for the file contents, please use so called raw strings:

String fallbackPaywalls = r'xxxxx' where "xxxxx" is copied from the file as is

samatzp commented 1 year ago

@vladd-g Thanks!