Skip to main content

Expo Go doesn’t build native modules, so you may run into this error while trying to run your app with react-native-purchases in Expo Go. 

 

In order to use RevenueCat with Expo, you will have to create Development Builds, which can be done either by using EAS, or by making builds that are compatible with Xcode and Android Studio. 

There are detailed instructions for doing either one in this page:

https://docs.expo.dev/development/build/

 

Easiest way to be able to debug is to just run either of the following:

npx expo run:android -d

npx expo run:ios -d

 

We also have a blog post that goes step-by-step into how to make an app with Expo and RevenueCat using EAS: https://www.revenuecat.com/blog/in-app-puchase-expo-managed-workflow/

 

Let us know if you run into any issues! 

@Andy This makes sense for me  that I can only test IAP under a build development. But I would like to keep using my app testing in ExpoGo even if IAP are not working.

I tried to import conditionally the library but seems doesn't work that way in React Native

Any clue how can I keep debugging my app in ExpoGo? no matter if IAP doesn't work.

 

import { IsExpoGo, RevenueCatAPIKeys } from "./lib/constants";

if(!IsExpoGo){
import Purchases, { PurchasesOffering } from 'react-native-purchases';
}

@Alejandro Did you ever find a solution to this?


nat-serrano@Nats-MacBook-Pro-2 Maxine % npx expo run:android -d

env: load .env
env: export EXPO_PUBLIC_11LABS_API_KEY EXPO_PUBLIC_SD_URL EXPO_PUBLIC_LLM_URL EXPO_PUBLIC_RC_ANDROID_KEY EXPO_PUBLIC_RC_IOS_KEY
✔️ Select a device/emulator › Pixel_6_Pro_API_34 (emulator)
› Using --device Pixel_6_Pro_API_34
› Building app...
Configuration on demand is an incubating feature.

> Configure project :app
 ℹ️  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' (expo-dev-launcher@3.6.6)

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not determine the dependencies of null.
   > SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/nat-serrano/Desktop/Maxine/android/local.properties'.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 4s
10 actionable tasks: 10 up-to-date
Error: /Users/nat-serrano/Desktop/Maxine/android/gradlew exited with non-zero code: 1
Error: /Users/nat-serrano/Desktop/Maxine/android/gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/nat-serrano/Desktop/Maxine/node_modules/@expo/cli/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:633:26)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
    ...
    at Object.spawnAsync ras default] (/Users/nat-serrano/Desktop/Maxine/node_modules/@expo/cli/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
    at spawnGradleAsync (/Users/nat-serrano/Desktop/Maxin/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46)
    at Object.assembleAsync (/Users/nat-serrano/Desktop/Maxine/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18)
    at runAndroidAsync (/Users/nat-serrano/Desktop/Maxine/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:36:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


this fixed the issue:
1) I imported the react native purchases 

2)I build a dev client build
 eas build --profile development --platform android

3) then launched the dev client
npx expo start --dev-client    

4)then opened it with the QR code and no more errorr


I am trying to integrate Revenue cat in my project but cannot get rid of this error 
>TypeError: Cannot read property 'setupPurchases' of null]
please provide me steps to solve this error as i have gone through all the above steps read articles watched videos implemented example and in every thing this error is common please help on this @React native team , @ Revenue cat community


Hi Andy thankyou for your  response i tried your suggestion but still its not working 

 

React-Native / Expo Go: How to solve `TypeError: null is not an object (evaluating 'RNPurchases.setupPurchases')`

 

 


I did this now like 5 times, and its not working. No matter what i try. Im running an eas build since some time because i have other native libs. And its always this same error. Did the tutorial exactly this way.

 

No freaking idea what this is.


Reply