Question

Android com.revenuecat.purchases.hybridcommon.CommonKt.purchasePackage java.lang.NullPointerException

  • 21 June 2023
  • 1 reply
  • 47 views

Badge +3

Hello i got a error about com.revenuecat.purchases.hybridcommon.CommonKt.purchasePackage java.lang.NullPointerException. Its working for me but when i check the Play Store Crashlytics i saw the this error. I tried the update version revenuecat 6 but i got still this error. How can i fix that. Can u help me please ? 

My code is 

 

const initPurchase = async () => {

try {

let deviceId = await global.deviceID;

Purchases.configure({

apiKey:

Platform.OS === 'ios' ? RevenueCat_API_KEY : RevenueCat_API_Google,

appUserID: deviceId,

});

} catch (e) {

console.log(e);

}

}


 

export const purchase = async product => {

 

try {

const { customerInfo } = await Purchases.purchasePackage(product);

const { entitlements } = customerInfo;

 

if (typeof entitlements.active[ENTITLEMENT_ID] !== 'undefined') {

OneSignal.sendTag('premium', 'true');

AsyncStorage.setItem('premium', 'true');

store.isPremiumUpdate(true);

return customerInfo;

} else {

return false;

}

} catch (e) {

Alert.alert(global.appName, e.message);

return false;

}

};

 


1 reply

Userlevel 5
Badge +9

Hi,

Are you able to get the whole stacktrace of this error from Crashlytics? That would really help us investigate.

Reply