Skip to content

Functionalities not working in release mode #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ttnisal opened this issue Jan 5, 2024 · 46 comments
Open

Functionalities not working in release mode #102

ttnisal opened this issue Jan 5, 2024 · 46 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@ttnisal
Copy link

ttnisal commented Jan 5, 2024

Description

Hi, We can subscribe to products and see paywalls in debug mode, But when we are on release mode the paywalls and functionalities are not working.

It gives the following error.

{"adaptyCode": 2006, "localized Description": "Failed to decode native...}

I have added the following configurations in proguard as well. But it doesn't seem to help

-keep class com.adapty.** { *; }

Adapty versions

 "@adapty/react-native-ui": "^2.0.0",
 "react-native-adapty": "^2.7.0"

Version

2.7.0

What platforms are you seeing the problem on?

Android

System info

System:
    OS: macOS 14.1.1
    CPU: (8) x64 Apple M1
    Memory: 267.18 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.12.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 9.6.6 - /usr/local/bin/npm
    Watchman: 2023.05.22.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.13.0 - /Users/ttn/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, watchOS 10.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.3 AI-223.8836.35.2231.11090377
    Xcode: 15.1/15C65 - /usr/bin/xcodebuild
  Languages:
    Java: 14.0.2 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: ^0.71.4 => 0.71.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
@ttnisal ttnisal added the bug Something isn't working label Jan 5, 2024
@vladd-g
Copy link
Contributor

vladd-g commented Jan 5, 2024

hi @ttnisal, I believe it's an obfuscation issue as well, could you please try adding the rules from here?

@ttnisal
Copy link
Author

ttnisal commented Jan 5, 2024

Hi @vladd-g I have pasted the whole code from that file to my proguard-rules.pro file. But it still has this issue.

This is the full error.

{"adaptyCode":2006,"localized Description":"Failed to decode native response. JSON.parse raised an error: JSON Parse error: Unexpected token: C"}

@vladd-g
Copy link
Contributor

vladd-g commented Jan 5, 2024

@ttnisal could you please also add some Adapty verbose logs around the error?

but anyway, it totally looks like an obfuscation problem, not the SDK bug

@ttnisal
Copy link
Author

ttnisal commented Jan 6, 2024

Hi @vladd-g ,

Here are the verbose logs

[21:43:48] D | ReactNativeJS ▶︎ '[2024-01-06T04:43:48.131Z] [[email protected]] "setLogLevel": <HOLD> Calling method', {}

[21:43:48] D | ReactNativeJS ▶︎ '[2024-01-06T04:43:48.267Z] [[email protected]] "parse": Decoding string...', { input: '{"data":{},"type":"null"}' }
                             │ '[2024-01-06T04:43:48.268Z] [[email protected]] "fetch/activate": Calling bridge function: OK', { response: '{"data":{},"type":"null"}' }
                             │ '[2024-01-06T04:43:48.269Z] [[email protected]] "activate": Calling method: OK', undefined
                             │ '[2024-01-06T04:43:48.269Z] [[email protected]] "setLogLevel": <UNLOCKED> Calling method', {}
                             └ '[2024-01-06T04:43:48.270Z] [[email protected]] "fetch/set_log_level": Calling bridge function...', { method: 'set_log_level', params: {} }

[21:43:48] D | ReactNativeJS ▶︎ '[2024-01-06T04:43:48.383Z] [[email protected]] "parse": Decoding string...', { input: '{"data":{},"type":"null"}' }
                             └ '[2024-01-06T04:43:48.383Z] [[email protected]] "fetch/set_log_level": Calling bridge function: OK', { response: '{"data":{},"type":"null"}' }

[21:43:48] D | ReactNativeJS ▶︎ '[2024-01-06T04:43:48.383Z] [[email protected]] "setLogLevel": Calling method: OK', undefined

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.254Z] [[email protected]] "getProfile": Calling method...', {}

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.256Z] [[email protected]] "fetch/get_profile": Calling bridge function...', { method: 'get_profile', params: {} }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.424Z] [[email protected]] "parse": Decoding string...', { input: '{"data":{"paid_access_levels":{"premium":{"activated_at":"2024-01-05T18:10:01.305000+0000","cancellation_reason":"unknown","expires_at":"2024-01-05T18:44:43.497000+0000","id":"premium","is_active":false,"is_in_grace_period":false,"is_lifetime":false,"is_refund":false,"renewed_at":"2024-01-05T18:39:41.130000+0000","store":"play_store","unsubscribed_at":"2024-01-05T18:44:43.497000+0000","vendor_product_id":"my_doc_said_subscription_group:p1m","will_renew":false}},"custom_attributes":{},"non_subscriptions":{},"profile_id":"2b212ad5-2f96-4d80-b082-a68e10bb1c0d","subscriptions":{"my_doc_said_subscription_group:p1m":{"activated_at":"2024-01-05T18:10:01.305000+0000","cancellation_reason":"unknown","expires_at":"2024-01-05T18:44:43.497000+0000","is_active":false,"is_in_grace_period":false,"is_lifetime":false,"is_refund":false,"is_sandbox":true,"renewed_at":"2024-01-05T18:39:41.130000+0000","store":"play_store","unsubscribed_at":"2024-01-05T18:44:43.497000+0000","vendor_original_transaction_id":"GPA.3314-XXXX-5429-XXXXX","vendor_product_id":"my_doc_said_subscription_group:p1m","vendor_transaction_id":"GPA.3314-XXXX-5429-XXXXX..5","will_renew":false}}},"type":"AdaptyProfile"}' }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.425Z] [[email protected]] "fetch/get_profile": Calling bridge function: OK', { response: '{"data":{"paid_access_levels":{"premium":{"activated_at":"2024-01-05T18:10:01.305000+0000","cancellation_reason":"unknown","expires_at":"2024-01-05T18:44:43.497000+0000","id":"premium","is_active":false,"is_in_grace_period":false,"is_lifetime":false,"is_refund":false,"renewed_at":"2024-01-05T18:39:41.130000+0000","store":"play_store","unsubscribed_at":"2024-01-05T18:44:43.497000+0000","vendor_product_id":"my_doc_said_subscription_group:p1m","will_renew":false}},"custom_attributes":{},"non_subscriptions":{},"profile_id":"2b212ad5-2f96-4d80-b082-a68e10bb1c0d","subscriptions":{"my_doc_said_subscription_group:p1m":{"activated_at":"2024-01-05T18:10:01.305000+0000","cancellation_reason":"unknown","expires_at":"2024-01-05T18:44:43.497000+0000","is_active":false,"is_in_grace_period":false,"is_lifetime":false,"is_refund":false,"is_sandbox":true,"renewed_at":"2024-01-05T18:39:41.130000+0000","store":"play_store","unsubscribed_at":"2024-01-05T18:44:43.497000+0000","vendor_original_transaction_id":"GPA.3314-XXXX-5429-XXXXX","vendor_product_id":"my_doc_said_subscription_group:p1m","vendor_transaction_id":"GPA.3314-XXXX-5429-XXXXX..5","will_renew":false}}},"type":"AdaptyProfile"}' }
                             │ '[2024-01-06T04:45:00.425Z] [[email protected]] "getProfile": Calling method: OK', { accessLevels:
                             │ { premium:
                             │ { activatedAt: Fri Jan 05 2024 11:10:01 GMT-0700,
                             │ cancellationReason: 'unknown',
                             │ expiresAt: Fri Jan 05 2024 11:44:43 GMT-0700,
                             │ id: 'premium',
                             │ isActive: false,
                             │ isInGracePeriod: false,
                             │ isLifetime: false,
                             │ isRefund: false,
                             │ renewedAt: Fri Jan 05 2024 11:39:41 GMT-0700,
                             │ store: 'play_store',
                             │ unsubscribedAt: Fri Jan 05 2024 11:44:43 GMT-0700,
                             │ vendorProductId: 'my_doc_said_subscription_group:p1m',
                             │ willRenew: false,
                             │ android: {} } },
                             │ customAttributes: {},
                             │ nonSubscriptions: {},
                             │ profileId: '2b212ad5-2f96-4d80-b082-a68e10bb1c0d',
                             │ subscriptions:
                             │ { 'my_doc_said_subscription_group:p1m':
                             │ { isActive: false,
                             │ isLifetime: false,
                             │ vendorProductId: 'my_doc_said_subscription_group:p1m',
                             │ store: 'play_store',
                             │ vendorTransactionId: 'GPA.3314-XXXX-5429-XXXXX..5',
                             │ vendorOriginalTransactionId: 'GPA.3314-XXXX-5429-XXXXX',
                             │ activatedAt: Fri Jan 05 2024 11:10:01 GMT-0700,
                             │ willRenew: false,
                             │ isInGracePeriod: false,
                             │ isRefund: false,
                             │ isSandbox: true,
                             │ renewedAt: Fri Jan 05 2024 11:39:41 GMT-0700,
                             │ expiresAt: Fri Jan 05 2024 11:44:43 GMT-0700,
                             │ unsubscribedAt: Fri Jan 05 2024 11:44:43 GMT-0700,
                             │ cancellationReason: 'unknown' } } }
                             │ '[2024-01-06T04:45:00.426Z] [[email protected]] "getPaywall": Calling method...', { id: 'home_placement', locale: undefined }
                             └ '[2024-01-06T04:45:00.426Z] [[email protected]] "fetch/get_paywall": Calling bridge function...', { method: 'get_paywall', params: {} }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.579Z] [[email protected]] "parse": Decoding string...', { input: '{"data":{"ab_test_name":"Monthly Subscription Paywall","use_paywall_builder":true,"developer_id":"home_placement","paywall_name":"Monthly Subscription Paywall","products":[{"timestamp":1704516302862,"vendor_product_id":"my_doc_said_subscription_group","base_plan_id":"p1m"}],"revision":1,"paywall_updated_at":1702450412899,"variation_id":"7d1a157a-2ea1-44e7-83f3-b157d84cc4d8","remote_config":{"lang":"en"}},"type":"AdaptyPaywall"}' }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.580Z] [[email protected]] "fetch/get_paywall": Calling bridge function: OK', { response: '{"data":{"ab_test_name":"Monthly Subscription Paywall","use_paywall_builder":true,"developer_id":"home_placement","paywall_name":"Monthly Subscription Paywall","products":[{"timestamp":1704516302862,"vendor_product_id":"my_doc_said_subscription_group","base_plan_id":"p1m"}],"revision":1,"paywall_updated_at":1702450412899,"variation_id":"7d1a157a-2ea1-44e7-83f3-b157d84cc4d8","remote_config":{"lang":"en"}},"type":"AdaptyPaywall"}' }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.580Z] [[email protected]] "getPaywall": Calling method: OK', { abTestName: 'Monthly Subscription Paywall',
                             │ hasViewConfiguration: true,
                             │ id: 'home_placement',
                             │ locale: 'en',
                             │ name: 'Monthly Subscription Paywall',
                             │ products:
                             │ [ { vendorId: 'my_doc_said_subscription_group',
                             │ ios: {},
                             │ android: { basePlanId: 'p1m' } } ],
                             │ revision: 1,
                             │ variationId: '7d1a157a-2ea1-44e7-83f3-b157d84cc4d8',
                             └ version: 1702450412899 }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.581Z] [[email protected]] "createController": Calling method...', { paywall:
                             │ { abTestName: 'Monthly Subscription Paywall',
                             │ hasViewConfiguration: true,
                             │ id: 'home_placement',
                             │ locale: 'en',
                             │ name: 'Monthly Subscription Paywall',
                             │ products:
                             │ [ { vendorId: 'my_doc_said_subscription_group',
                             │ ios: {},
                             │ android: { basePlanId: 'p1m' } } ],
                             │ revision: 1,
                             │ variationId: '7d1a157a-2ea1-44e7-83f3-b157d84cc4d8',
                             │ version: 1702450412899 },
                             └ params: {} }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.582Z] [[email protected]] "fetch/create_view": Calling bridge function...', { method: 'create_view', params: {} }

[21:45:00] I | ReactNativeJS ▶︎ synchronized data

[21:45:00] I | ReactNativeJS ▶︎ 'updateFCMToken', { message: 'Tasks completed successfully' }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.742Z] [[email protected]] "parse": Decoding string...', { input: '{"a":"abe22e1e-77f9-468b-bc40-4783032b673d","b":"String","c":""}' }
                             └ '[2024-01-06T04:45:00.742Z] [[email protected]] "fetch/create_view": Calling bridge function: OK', { error: [TypeError: Cannot create property '__stack__' on string '#2006 (decodingFailed): Failed to decode native response. Response does not have expected "type" property'] }

[21:45:00] D | ReactNativeJS ▶︎ '[2024-01-06T04:45:00.742Z] [[email protected]] "createController": Calling method: OK', { error:
                             │ { [Error: #2006 (decodingFailed): Failed to decode native response. JSON.parse raised an error: JSON Parse error: Unexpected token: C]
                             │ adaptyCode: 2006,
                             │ localizedDescription: 'Failed to decode native response. JSON.parse raised an error: JSON Parse error: Unexpected token: C',
                             └ detail: undefined } }

[21:45:00] I | ReactNativeJS ▶︎ 'adapty paywall error', { [Error: #2006 (decodingFailed): Failed to decode native response. JSON.parse raised an error: JSON Parse error: Unexpected token: C]
                             │ adaptyCode: 2006,
                             │ localizedDescription: 'Failed to decode native response. JSON.parse raised an error: JSON Parse error: Unexpected token: C',
                             └ detail: undefined }

@vladd-g
Copy link
Contributor

vladd-g commented Jan 6, 2024

Hi @ttnisal,

do you have something like proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' on the same level as minifyEnabled true?

@ttnisal
Copy link
Author

ttnisal commented Jan 6, 2024

Hi @vladd-g , yes I have like this

            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

@vladd-g
Copy link
Contributor

vladd-g commented Jan 6, 2024

@ttnisal are those proguard rules above in the right proguard-rules.pro file? it should be on the same level as the build.gradle file that contains the lines from the above comment

@ttnisal
Copy link
Author

ttnisal commented Jan 6, 2024

Hi @vladd-g , I didn't quite get what you meant as same level.

All the proguard rules mentioned here was place inside the proguard-rules.pro file in the android/app folder.

And in the build.gradle, the configs are placed in the same buildType like below

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

Could you explain a little bit more?
Thanks

@vladd-g
Copy link
Contributor

vladd-g commented Jan 6, 2024

@ttnisal by "same level" I meant same level in the project hierarchy, that would mean that you've chosen the right proguard-rules.pro

'{"a":"abe22e1e-77f9-468b-bc40-4783032b673d","b":"String","c":""}' shows that this model have been obfuscated, but I wonder why as the relevant proguard rules have been added

@ttnisal
Copy link
Author

ttnisal commented Jan 7, 2024

Hi @vladd-g, yes they are on the same level in the project hierarchy. Are there any other library that can cause the obfuscation?

@ttnisal
Copy link
Author

ttnisal commented Jan 8, 2024

Hi @vladd-g , by any chance does the package @adapty/react-native-ui need any proguard rules?

@vladd-g
Copy link
Contributor

vladd-g commented Jan 8, 2024

Hi @ttnisal

Are there any other library that can cause the obfuscation?

I think no, it looks like only these two.

does the package @adapty/react-native-ui need any proguard rules

Again, it doesn’t look so, as the json from your snippet is from a model that shares the same package com.adapty as in the proguard rule.

Can you perform Build -> Analyze APK in Android Studio to inspect what exactly got obfuscated?

@ttnisal
Copy link
Author

ttnisal commented Jan 9, 2024

Hi @vladd-g, I have analysed the APK in release mode. I think as the following image the adapty and gson classes are not obfuscated.

Screenshot 2024-01-09 at 21 11 02

However the other source code seems to be obfuscated.

Screenshot 2024-01-09 at 21 14 50

Do you have any thoughts on this?

@vladd-g
Copy link
Contributor

vladd-g commented Jan 9, 2024

@ttnisal could you please expand com/adapty/internal/crossplatform/ui? this is the package of that model from json you provided with obfuscated keys

@ttnisal
Copy link
Author

ttnisal commented Jan 9, 2024

@vladd-g, This is the expanded view for the package.

Screenshot 2024-01-09 at 21 35 44

But I can see something like this

Screenshot 2024-01-09 at 21 39 28

@vladd-g
Copy link
Contributor

vladd-g commented Jan 9, 2024

@ttnisal suppose AdaptyUiView is not obfuscated, right?

@ttnisal
Copy link
Author

ttnisal commented Jan 9, 2024

HI @vladd-g, seems like it's not

Screenshot 2024-01-09 at 23 25 10

@vladd-g
Copy link
Contributor

vladd-g commented Jan 9, 2024

@ttnisal can you also try adding this?

-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

@ttnisal
Copy link
Author

ttnisal commented Jan 10, 2024

Hi @vladd-g , No luck in adding that also.

To make sure the proguard-rules.pro file is working fine. I have added the following config to exclude all classes from being obfuscated. And it opens up the paywall.

-keep class ** { *; }

@vladd-g
Copy link
Contributor

vladd-g commented Jan 10, 2024

@ttnisal could you please send the obfuscated apk to [email protected]? Please also add the link to the issue in your email so that we know the context

@ttnisal
Copy link
Author

ttnisal commented Jan 11, 2024

Hi @vladd-g, I have sent the email.

Thanks

@vladd-g
Copy link
Contributor

vladd-g commented Jan 11, 2024

@ttnisal thanks!

@HermenegildoMI
Copy link

Hey. I have the same issue on android react native project.

I noted the conversation went into email, any update on this for someone who is facing the same issues ? @vladd-g @ttnisal

Thank you in advance.

@vladd-g
Copy link
Contributor

vladd-g commented Jan 15, 2024

@HermenegildoMI investigating

@vladd-g
Copy link
Contributor

vladd-g commented Jan 15, 2024

@ttnisal @HermenegildoMI could you please also add the following line to the config? -keep class io.adapty.** { *; }

@HermenegildoMI
Copy link

HermenegildoMI commented Jan 15, 2024

Hi @vladd-g . Thank you for the prompt response.

I added -keep class io.adapty.** { *; } and got a new error in release mode.

When opening a Paywall view, the app crashes with the following logs:

In code:

const paywall = await adapty.getPaywall(paywallId);

if(paywall.hasViewConfiguration){
viewController = await createPaywallView(paywall);
await viewController.present();
}

Adapty Logs before crashing:

Note: actual id's were removed

'[AdapterPaywall]: ', { abTestName: 'Android Test Paywall',
                                                                                                      hasViewConfiguration: true,
                                                                                                      id: 'default-settings',
                                                                                                      locale: 'en',
                                                                                                      name: 'Android Test Paywall',
                                                                                                      products: 
                                                                                                       [ { vendorId: '<insert valid id>',
                                                                                                           ios: {},
                                                                                                           android: { basePlanId: 'p3m', offerId: 'freetrial' } } ],
                                                                                                      revision: 1,
                                                                                                      variationId: '<insert valid id>',
                                                                                                      version: 1704953916220 }
2024-01-15 20:23:19.665 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:19.663Z] [[email protected]] "createController": Calling method...', { paywall: 
                                                                                                       { abTestName: 'Android Test Paywall',
                                                                                                         hasViewConfiguration: true,
                                                                                                         id: 'default-settings',
                                                                                                         locale: 'en',
                                                                                                         name: 'Android Test Paywall',
                                                                                                         products: 
                                                                                                          [ { vendorId: '<insert valid id>',
                                                                                                              ios: {},
                                                                                                              android: { basePlanId: 'p3m', offerId: 'freetrial' } } ],
                                                                                                         revision: 1,
                                                                                                         variationId: '<insert id>',
                                                                                                         version: 1704953916220 },
                                                                                                      params: {} }
'[2024-01-15T20:23:19.670Z] [[email protected]] "fetch/create_view": Calling bridge function...', { method: 'create_view', params: {} }
2024-01-15 20:23:20.635 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.634Z] [[email protected]] "parse": Decoding string...', { input: '{"data":"19a6fcf4-b0da-4c59-8168-8e2a91fdea8c","type":"String","view":""}' }
2024-01-15 20:23:20.636 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.635Z] [[email protected]] "fetch/create_view": Calling bridge function: OK', { response: '{"data":"19a6fcf4-b0da-4c59-8168-8e2a91fdea8c","type":"String","view":""}' }
2024-01-15 20:23:20.637 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.637Z] [[email protected]] "createController": Calling method: OK', '19a6fcf4-b0da-4c59-8168-8e2a91fdea8c'
2024-01-15 20:23:20.643 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.639Z] [[email protected]] "registerEventHandlers": Calling method...', { _id: '19a6fcf4-b0da-4c59-8168-8e2a91fdea8c' }
2024-01-15 20:23:20.655 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.653Z] [[email protected]] "present": Calling method...', { _id: '19a6fcf4-b0da-4c59-8168-8e2a91fdea8c' }
2024-01-15 20:23:20.657 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.656Z] [[email protected]] "fetch/present_view": Calling bridge function...', { method: 'present_view', params: {} }
2024-01-15 20:23:20.722 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.722Z] [[email protected]] "parse": Decoding string...', { input: '{"data":{},"type":"null","view":"19a6fcf4-b0da-4c59-8168-8e2a91fdea8c"}' }
2024-01-15 20:23:20.723 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.722Z] [[email protected]] "fetch/present_view": Calling bridge function: OK', { response: '{"data":{},"type":"null","view":"19a6fcf4-b0da-4c59-8168-8e2a91fdea8c"}' }
2024-01-15 20:23:20.723 26807-26909 ReactNativeJS           pid-26807                            D  '[2024-01-15T20:23:20.723Z] [[email protected]] "present": Calling method: OK', undefined

App Crash Error:

java.lang.NoSuchMethodError • AdaptyUiActivityNo static method create(Landroid/content/Context;Landroid/graphics/Typeface;IZ)Landroid/graphics/Typeface; in class Lc/h/f/d; or its super classes (declaration of 'c.h.f.d' appears in base.apk)
--
Screenshot 2024-01-15 at 20 30 00

@ttnisal
Copy link
Author

ttnisal commented Jan 15, 2024

I got this weird issue where I only get the paywall pop up only in the first time I open up the app. If I close the app and open it I won't get it. I'm getting it only after reinstalling the app. This is on debug mode btw

@vladd-g
Copy link
Contributor

vladd-g commented Jan 16, 2024

@ttnisal working on it

@vladd-g
Copy link
Contributor

vladd-g commented Jan 16, 2024

@HermenegildoMI could you please provide full stacktrace of the crash itself?

@HermenegildoMI
Copy link

@HermenegildoMI could you please provide full stacktrace of the crash itself?

Here you go @vladd-g

java.lang.NoSuchMethodError: No static method create(Landroid/content/Context;Landroid/graphics/Typeface;IZ)Landroid/graphics/Typeface; in class Lc/h/f/d; or its super classes (declaration of 'c.h.f.d' appears in base.apk)
        at com.adapty.ui.internal.TypefaceHolder.getOrPut(TypefaceHolder.kt:20)
        at com.adapty.ui.internal.TextComponentHelper.processTextItem(TextComponentHelper.kt:251)
        at com.adapty.ui.internal.TextComponentHelper.processTextComponent(TextComponentHelper.kt:78)
        at com.adapty.ui.internal.TextComponentHelper.processTextComponent$default(TextComponentHelper.kt:28)
        at com.adapty.ui.internal.ViewHelper.createView(ViewHelper.kt:37)
        at com.adapty.ui.internal.FlatPaywallRenderer.render(PaywallRenderer.kt:575)
        at com.adapty.ui.internal.PaywallUiManager.buildLayout(PaywallUiManager.kt:61)
        at com.adapty.ui.internal.PaywallPresenter.showPaywall(PaywallPresenter.kt:84)
        at com.adapty.ui.AdaptyPaywallView.showPaywall(AdaptyPaywallView.kt:95)
        at com.adapty.internal.crossplatform.ui.AdaptyUiActivity$onCreate$1$1.invoke(AdaptyUiActivity.kt:49)
        at com.adapty.internal.crossplatform.ui.AdaptyUiActivity$onCreate$1$1.invoke(AdaptyUiActivity.kt:41)
        at com.adapty.internal.crossplatform.ui.AdaptyUiActivity.onReceiveSystemBarsInsets$lambda-3(AdaptyUiActivity.kt:95)
        at com.adapty.internal.crossplatform.ui.AdaptyUiActivity.lambda$-prMK8seUuop9fZBuAKSnG_jMOs(AdaptyUiActivity)
        at com.adapty.internal.crossplatform.ui.a.a(Unknown:4)
        at androidx.core.view.ViewCompat$Api21Impl$1.onApplyWindowInsets(ViewCompat.java:4858)
        at android.view.View.dispatchApplyWindowInsets(View.java:12010)
        at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7715)
        at android.view.ViewGroup.newDispatchApplyWindowInsets(ViewGroup.java:7740)
        at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7722)
        at android.view.ViewGroup.newDispatchApplyWindowInsets(ViewGroup.java:7740)
        at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7722)
        at android.view.ViewGroup.newDispatchApplyWindowInsets(ViewGroup.java:7740)
        at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7722)
        at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:3527)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3671)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3116)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10885)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1301)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1309)
        at android.view.Choreographer.doCallbacks(Choreographer.java:923)
        at android.view.Choreographer.doFrame(Choreographer.java:852)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1283)
        at android.os.Handler.handleCallback(Handler.java:942)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.app.ActivityThread.main(ActivityThread.java:8762)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

@vladd-g
Copy link
Contributor

vladd-g commented Jan 16, 2024

@HermenegildoMI thank you!

Do you experience it only in release mode, with minifyEnabled on?

@HermenegildoMI
Copy link

HermenegildoMI commented Jan 16, 2024

@HermenegildoMI thank you!

Do you experience it only in release mode, with minifyEnabled on?

Yes. That is correct. release mode, minify on. @vladd-g

@vladd-g
Copy link
Contributor

vladd-g commented Jan 16, 2024

@HermenegildoMI but if you switch to debug or disable minifying, the issue is gone? just to make sure

@HermenegildoMI
Copy link

HermenegildoMI commented Jan 17, 2024

@HermenegildoMI but if you switch to debug or disable minifying, the issue is gone? just to make sure

@vladd-g i was only able to open paywall view once and haven't been able to open it again since then in debug mode.

I'm not sure that counts as working correctly. Very similar description to @ttnisal 's comments about debug mode. See quote below.

I got this weird issue where I only get the paywall pop up only in the first time I open up the app. If I close the app and open it I won't get it. I'm getting it only after reinstalling the app. This is on debug mode btw

@vladd-g
Copy link
Contributor

vladd-g commented Jan 17, 2024

@HermenegildoMI @ttnisal could you please check these issues on v2.0.1?

@ttnisal
Copy link
Author

ttnisal commented Jan 18, 2024

Hi @vladd-g, thanks for the update, seems like the pop-up appearing for only one time issue is still there.

When trying to open it for the second time I got this logs

[[email protected]] "identify": Calling method... {"customerUserId": "XXXX"}
[[email protected]] "fetch/identify": Calling bridge function... {"method": "identify", "params": Map {"user_id" => "XXXX"}}
[[email protected]] "parse": Decoding string... {"input": "{\"data\":{},\"type\":\"null\"}"}
[[email protected]] "fetch/identify": Calling bridge function: OK {"response": "{\"data\":{},\"type\":\"null\"}"}
[[email protected]] "identify": Calling method: OK undefined
[[email protected]] "getProfile": Calling method... {}
[[email protected]] "fetch/get_profile": Calling bridge function... {"method": "get_profile", "params": Map {}}
[[email protected]] "parse": Decoding string... {"input": "{\"data\":{\"paid_access_levels\":{\"premium\":{\"activated_at\":\"2023-12-27T23:21:30.000000+0000\",\"cancellation_reason\":\"voluntarily_cancelled\",\"expires_at\":\"2024-01-17T21:51:53.000000+0000\",\"id\":\"premium\",\"is_active\":false,\"is_in_grace_period\":false,\"is_lifetime\":false,\"is_refund\":false,\"renewed_at\":\"2024-01-17T21:46:53.000000+0000\",\"store\":\"app_store\",\"unsubscribed_at\":\"2024-01-17T21:47:04.126116+0000\",\"vendor_product_id\":\"subscription_monthly\",\"will_renew\":false}},\"custom_attributes\":{},\"customer_user_id\":\"XXXX\",\"non_subscriptions\":{},\"profile_id\":\"YYYY\",\"subscriptions\":{\"subscription_monthly\":{\"activated_at\":\"2023-12-27T23:21:30.000000+0000\",\"cancellation_reason\":\"voluntarily_cancelled\",\"expires_at\":\"2024-01-17T21:51:53.000000+0000\",\"is_active\":false,\"is_in_grace_period\":false,\"is_lifetime\":false,\"is_refund\":false,\"is_sandbox\":true,\"renewed_at\":\"2024-01-17T21:46:53.000000+0000\",\"store\":\"app_store\",\"unsubscribed_at\":\"2024-01-17T21:47:04.035915+0000\",\"vendor_original_transaction_id\":\"2000000489007834\",\"vendor_product_id\":\"subscription_monthly\",\"vendor_transaction_id\":\"2000000502999990\",\"will_renew\":false},\"subscription_group:p1m\":{\"activated_at\":\"2024-01-16T23:57:54.840000+0000\",\"cancellation_reason\":\"unknown\",\"expires_at\":\"2024-01-17T00:32:29.948000+0000\",\"is_active\":false,\"is_in_grace_period\":false,\"is_lifetime\":false,\"is_refund\":false,\"is_sandbox\":true,\"renewed_at\":\"2024-01-17T00:27:26.560000+0000\",\"store\":\"play_store\",\"unsubscribed_at\":\"2024-01-17T00:32:29.948000+0000\",\"vendor_original_transaction_id\":\"GPA.XXXX-XXXX-XXXX-XXXXX\",\"vendor_product_id\":\"subscription_group:p1m\",\"vendor_transaction_id\":\"GPA.XXXX-XXXX-XXXX-XXXXX..5\",\"will_renew\":false}}},\"type\":\"AdaptyProfile\"}"}
[[email protected]] "fetch/get_profile": Calling bridge function: OK {"response": "{\"data\":{\"paid_access_levels\":{\"premium\":{\"activated_at\":\"2023-12-27T23:21:30.000000+0000\",\"cancellation_reason\":\"voluntarily_cancelled\",\"expires_at\":\"2024-01-17T21:51:53.000000+0000\",\"id\":\"premium\",\"is_active\":false,\"is_in_grace_period\":false,\"is_lifetime\":false,\"is_refund\":false,\"renewed_at\":\"2024-01-17T21:46:53.000000+0000\",\"store\":\"app_store\",\"unsubscribed_at\":\"2024-01-17T21:47:04.126116+0000\",\"vendor_product_id\":\"subscription_monthly\",\"will_renew\":false}},\"custom_attributes\":{},\"customer_user_id\":\"XXXX\",\"non_subscriptions\":{},\"profile_id\":\"YYYY\",\"subscriptions\":{\"subscription_monthly\":{\"activated_at\":\"2023-12-27T23:21:30.000000+0000\",\"cancellation_reason\":\"voluntarily_cancelled\",\"expires_at\":\"2024-01-17T21:51:53.000000+0000\",\"is_active\":false,\"is_in_grace_period\":false,\"is_lifetime\":false,\"is_refund\":false,\"is_sandbox\":true,\"renewed_at\":\"2024-01-17T21:46:53.000000+0000\",\"store\":\"app_store\",\"unsubscribed_at\":\"2024-01-17T21:47:04.035915+0000\",\"vendor_original_transaction_id\":\"2000000489007834\",\"vendor_product_id\":\"subscription_monthly\",\"vendor_transaction_id\":\"2000000502999990\",\"will_renew\":false},\"subscription_group:p1m\":{\"activated_at\":\"2024-01-16T23:57:54.840000+0000\",\"cancellation_reason\":\"unknown\",\"expires_at\":\"2024-01-17T00:32:29.948000+0000\",\"is_active\":false,\"is_in_grace_period\":false,\"is_lifetime\":false,\"is_refund\":false,\"is_sandbox\":true,\"renewed_at\":\"2024-01-17T00:27:26.560000+0000\",\"store\":\"play_store\",\"unsubscribed_at\":\"2024-01-17T00:32:29.948000+0000\",\"vendor_original_transaction_id\":\"GPA.XXXX-XXXX-XXXX-XXXXX\",\"vendor_product_id\":\"subscription_group:p1m\",\"vendor_transaction_id\":\"GPA.XXXX-XXXX-XXXX-XXXXX..5\",\"will_renew\":false}}},\"type\":\"AdaptyProfile\"}"}
[[email protected]] "getProfile": Calling method: OK {"accessLevels": {"premium": {"activatedAt": 2023-12-27T23:21:30.000Z, "android": [Object], "cancellationReason": "voluntarily_cancelled", "expiresAt": 2024-01-17T21:51:53.000Z, "id": "premium", "isActive": false, "isInGracePeriod": false, "isLifetime": false, "isRefund": false, "renewedAt": 2024-01-17T21:46:53.000Z, "store": "app_store", "unsubscribedAt": 2024-01-17T21:47:04.000Z, "vendorProductId": "subscription_monthly", "willRenew": false}}, "customAttributes": {}, "customerUserId": "XXXX", "nonSubscriptions": {}, "profileId": "YYYY", "subscriptions": {"subscription_monthly": {"activatedAt": 2023-12-27T23:21:30.000Z, "cancellationReason": "voluntarily_cancelled", "expiresAt": 2024-01-17T21:51:53.000Z, "isActive": false, "isInGracePeriod": false, "isLifetime": false, "isRefund": false, "isSandbox": true, "renewedAt": 2024-01-17T21:46:53.000Z, "store": "app_store", "unsubscribedAt": 2024-01-17T21:47:04.000Z, "vendorOriginalTransactionId": "2000000489007834", "vendorProductId": "subscription_monthly", "vendorTransactionId": "2000000502999990", "willRenew": false}, "subscription_group:p1m": {"activatedAt": 2024-01-16T23:57:54.000Z, "cancellationReason": "unknown", "expiresAt": 2024-01-17T00:32:29.000Z, "isActive": false, "isInGracePeriod": false, "isLifetime": false, "isRefund": false, "isSandbox": true, "renewedAt": 2024-01-17T00:27:26.000Z, "store": "play_store", "unsubscribedAt": 2024-01-17T00:32:29.000Z, "vendorOriginalTransactionId": "GPA.XXXX-XXXX-XXXX-XXXXX", "vendorProductId": "subscription_group:p1m", "vendorTransactionId": "GPA.XXXX-XXXX-XXXX-XXXXX..5", "willRenew": false}}}
[[email protected]] "getPaywall": Calling method... {"id": "home_placement", "locale": undefined}
[[email protected]] "fetch/get_paywall": Calling bridge function... {"method": "get_paywall", "params": Map {"id" => "home_placement"}}
[[email protected]] "parse": Decoding string... {"input": "{\"data\":{\"ab_test_name\":\"Monthly Subscription Paywall\",\"use_paywall_builder\":true,\"developer_id\":\"home_placement\",\"paywall_name\":\"Monthly Subscription Paywall\",\"products\":[{\"timestamp\":1705545200954,\"vendor_product_id\":\"subscription_group\",\"base_plan_id\":\"p1m\"}],\"revision\":1,\"paywall_updated_at\":1702450412899,\"variation_id\":\"7d1a157a-2ea1-44e7-83f3-b157d84cc4d8\",\"remote_config\":{\"lang\":\"en\"}},\"type\":\"AdaptyPaywall\"}"}
[[email protected]] "fetch/get_paywall": Calling bridge function: OK {"response": "{\"data\":{\"ab_test_name\":\"Monthly Subscription Paywall\",\"use_paywall_builder\":true,\"developer_id\":\"home_placement\",\"paywall_name\":\"Monthly Subscription Paywall\",\"products\":[{\"timestamp\":1705545200954,\"vendor_product_id\":\"subscription_group\",\"base_plan_id\":\"p1m\"}],\"revision\":1,\"paywall_updated_at\":1702450412899,\"variation_id\":\"7d1a157a-2ea1-44e7-83f3-b157d84cc4d8\",\"remote_config\":{\"lang\":\"en\"}},\"type\":\"AdaptyPaywall\"}"}
[[email protected]] "getPaywall": Calling method: OK {"abTestName": "Monthly Subscription Paywall", "hasViewConfiguration": true, "id": "home_placement", "locale": "en", "name": "Monthly Subscription Paywall", "products": [{"android": [Object], "ios": [Object], "vendorId": "subscription_group"}], "revision": 1, "variationId": "7d1a157a-2ea1-44e7-83f3-b157d84cc4d8", "version": 1702450412899}
[[email protected]] "createController": Calling method... {"params": {}, "paywall": {"abTestName": "Monthly Subscription Paywall", "hasViewConfiguration": true, "id": "home_placement", "locale": "en", "name": "Monthly Subscription Paywall", "products": [[Object]], "revision": 1, "variationId": "7d1a157a-2ea1-44e7-83f3-b157d84cc4d8", "version": 1702450412899}}
[[email protected]] "fetch/create_view": Calling bridge function... {"method": "create_view", "params": Map {"paywall" => "{\"ab_test_name\":\"Monthly Subscription Paywall\",\"use_paywall_builder\":true,\"developer_id\":\"home_placement\",\"remote_config\":{\"lang\":\"en\"},\"paywall_name\":\"Monthly Subscription Paywall\",\"products\":[{\"vendor_product_id\":\"subscription_group\",\"base_plan_id\":\"p1m\"}],\"revision\":1,\"variation_id\":\"7d1a157a-2ea1-44e7-83f3-b157d84cc4d8\",\"paywall_updated_at\":1702450412899}", "prefetch_products" => true}}
[[email protected]] "parse": Decoding string... {"input": "{\"data\":\"6e6b4be4-490b-48e8-b2da-94fa8f1911f2\",\"type\":\"String\",\"view\":\"\"}"}
[[email protected]] "fetch/create_view": Calling bridge function: OK {"response": "{\"data\":\"6e6b4be4-490b-48e8-b2da-94fa8f1911f2\",\"type\":\"String\",\"view\":\"\"}"}
[[email protected]] "createController": Calling method: OK 6e6b4be4-490b-48e8-b2da-94fa8f1911f2
[[email protected]] "registerEventHandlers": Calling method... {"_id": "6e6b4be4-490b-48e8-b2da-94fa8f1911f2"}
[[email protected]] "present": Calling method... {"_id": "6e6b4be4-490b-48e8-b2da-94fa8f1911f2"}
[[email protected]] "fetch/present_view": Calling bridge function... {"method": "present_view", "params": Map {"view_id" => "6e6b4be4-490b-48e8-b2da-94fa8f1911f2"}}
[[email protected]] "fetch/present_view": Calling bridge function: OK {"error": [Error: {"data":"{\"error_type\":\"WRONG_PARAMETER\",\"name\":\"AdaptyUIError.viewAlreadyPresented(6e6b4be4-490b-48e8-b2da-94fa8f1911f2)\"}","type":"BridgeError","view":""}]}
[[email protected]] "present": Calling method: OK {"error": [Error: #2006 (decodingFailed): Failed to decode native response, because it is missing required property "errorType"]}
 LOG  adapty paywall error [Error: #2006 (decodingFailed): Failed to decode native response, because it is missing required property "errorType"]

@vladd-g
Copy link
Contributor

vladd-g commented Jan 18, 2024

hi @ttnisal, could you please double-check that you don't call present twice on the same view?

@ttnisal
Copy link
Author

ttnisal commented Jan 18, 2024

Hi @vladd-g , I double checked, seems like If I close the app without closing the paywall and restart it only I get the issue. If I close the paywall and close the app and start again I don't get any errors. Can see the paywall again.

@vladd-g
Copy link
Contributor

vladd-g commented Jan 18, 2024

@ttnisal do the logs above match this case? or do you have new ones?

@ttnisal
Copy link
Author

ttnisal commented Jan 18, 2024

@vladd-g I can send you new ones. Shall I email it to [email protected]?

@vladd-g
Copy link
Contributor

vladd-g commented Jan 18, 2024

@ttnisal yes, thank you! please also add the link to the issue to your email

@ttnisal
Copy link
Author

ttnisal commented Jan 18, 2024

@vladd-g, Sent the logs

@vladd-g
Copy link
Contributor

vladd-g commented Feb 28, 2024

hi @ttnisal, could you please update to the 2.9.6 and 2.1.0 respectively?

@vladd-g vladd-g added help wanted Extra attention is needed and removed bug Something isn't working labels Apr 25, 2024
@rennard
Copy link

rennard commented Aug 16, 2024

I also have the issue with the view having shown once subsequently giving me the "AdaptyUIError.viewAlreadyPresented" error. I've gotta say, the docs on error codes etc. are really lacking

@vladd-g
Copy link
Contributor

vladd-g commented Aug 16, 2024

hi @rennard, we'll review the docs, thank you for the report!

@rennard
Copy link

rennard commented Aug 16, 2024

For reference, it seemed like clearing the cache for the app and relaunching seemed to fix this. I believe it was due to hot reload crashing the app while the paywall was visible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants