adaptyteam / AdaptySDK-React-Native

React Native SDK for growing in-app subscriptions
https://docs.adapty.io/docs/quickstart
MIT License
125 stars 12 forks source link

Attempt to invoke virtual method 'java.lang.String com.google.gson..JsonElement.getAsString()' on a null object reference #106

Closed eliezerBrasilian closed 9 months ago

eliezerBrasilian commented 9 months ago

Description

thats is all the configurations I maded it, this errors ocurrs when I trying to make a purchase.

  1. Here is implementation of class that call makePurchase() from adapty

image

  1. Executing the method
    
    //imports and so on...
    var payment = new Payment();

<Button onClick={() => payment.makePurchase()} title={'Comprar acesso Premium'} fontSize={17} backgroundColor="#4453DF" paddingVertical={9} />


3. My Paywall on Adapty
![image](https://github.com/adaptyteam/AdaptySDK-React-Native/assets/93846923/95c974d8-fab5-43e9-83ab-957cf9665601)

4. My product on Adapty
![image](https://github.com/adaptyteam/AdaptySDK-React-Native/assets/93846923/e77741ec-64f1-4edd-a129-05aecbf3e71e)

5. My placement on Adapty
![image](https://github.com/adaptyteam/AdaptySDK-React-Native/assets/93846923/9072fb2a-ebde-442c-bc62-ba03c5d7e7ba)

6. Subscription created on Google Play Console
![image](https://github.com/adaptyteam/AdaptySDK-React-Native/assets/93846923/f47b8d58-2541-4b35-9160-1ddec1ae7420)

### Version

v2.9.1

### What platforms are you seeing the problem on?

Android

### System info

```yml
Attempt to invoke virtual method 'java.lang.String com.google.gson..JsonElement.getAsString()' on a null object reference
vladd-g commented 9 months ago

hi @eliezerBrasilian

Products are not designed to be created manually in code, please obtain them with adapty.getPaywall(id, locale) and then adapty.getPaywallProducts(paywall) as follows

eliezerBrasilian commented 9 months ago

thank you, i'll try it out

eliezerBrasilian commented 9 months ago

now i am with this Error:

Error: #103 (undefined): Play Market request failed: Google Play In-app Billing API version is less than 3

Thats my AndroidManifest

image

vladd-g commented 9 months ago

Looks like you're using an emulator with no Google Play. Could you please use either a real device or an emulator with Google Play (you can check it when pick the right version of the OS while configuring an emulator), and then log in your Google account?

eliezerBrasilian commented 9 months ago

Thank you, now It almost there, Im having this issue, how to proceed?

Screenshot_2024-01-21-19-53-26-312_com.android.vending.jpg

vladd-g commented 9 months ago

Please prepare your environment for testing as outlined in this checklist

eliezerBrasilian commented 9 months ago

all right, do I need to activate Google integrity, or is it not necessary?

image

eliezerBrasilian commented 9 months ago

Thank you, I got

Screenshot_2024-01-22-11-42-13-848_com.android.vending.jpg